udev - usb add / remove 
Because udev didn't know anything of idVendor or idProduct if you remove a device i use ENV{PRODUCT} to match for my unplugged device:

ACTION=="add", KERNEL=="event*", SUBSYSTEM=="input", \
SYSFS{idVendor}=="1234", SYSFS{idProduct}=="5678", \

ACTION=="remove", SUBSYSTEM=="usb", \
ENV{PRODUCT}=="1234/5678/100", \
RUN+="/usr/bin/killall myprog"

[ view entry ] ( 862 views )   |  print article

File Permissions

Action --- r-- -w- --x rw- r-x -wx rwx r-s
read - cat file no yes no no yes yes no yes
write - ls /tmp >> file no no yes no yes no yes yes
write - ls /tmp > file no no yes no yes no yes yes
remove file yes* yes* yes yes* yes yes* yes yes
executing a script no no no no no yes no yes yes**

yes*: These files gave a "rm: remove write-protected file 'filename'?" error. Saying "yes" removes these files. Also performing a "rm -rf" file removes the file without any warning. The ability to remove a file is controlled at the directory level.
yes**: execute a file with permission of owner or group

Directory Permissions

Action --- r-- -w- --x rw- r-x -wx rwx
cd into directory no no no yes no yes yes yes
ls directory no yes* no no yes* yes no yes
file name completion no yes no no yes yes no yes
create new file in dir. no no no no no no yes yes
read file in dir. no no no yes no yes yes yes
modify file in dir. no no no yes no yes yes yes
remove files no no no no no no yes yes
execute script no no no yes no yes yes yes

ls = yes* - Only the files are listed with error. No other file attributes are able to be listed. File name completion works in these cases as well.

t - Save text attribute (sticky bit): The user may delete or modify only those files in the directory that they own or have write permission for (/tmp).

s - Set group ID: files in that directory will have the group ownership as the directory, instead of than the group of the user that created the file

If you want to have full access to a directory with 2 different users in different groups make a new group and add both users.

addgroup newgroup
adduser user1 newgroup
adduser user2 newgroup

chown root:newgroup /directory
chmod 775 /directory

You do not need to use group ID (s-Flag).

You can use these commands to set 755 on directories and 644 on files

find -type f -exec chmod 644 {} \;
find -type d -exec chmod 755 {} \;

[ view entry ] ( 1063 views )   |  print article
Monitoring filesystem activity under Linux with block_dump 
sudo sysctl vm.block_dump=1


echo 1 > /proc/sys/vm/block_dump

tail -f /var/log/kern.log

[ view entry ] ( 2930 views )   |  print article
ntfs read/write with feisty 
apt-get install ntfs-g3


vol_id /dev/sda1

UUID=5EFC7B02FC7AD42D   /media/usbhdd ntfs-3g rw,users,uid=1000,guid=1000,umask=007,locale=de_AT.utf8,force   0    0
user can mount but not unmount

wget http://launchpadlibrarian.net/7435949/u ... ount.patch

$ sudo apt-get update
$ sudo apt-get install build-essential
$ sudo apt-get build-dep mount
$ cd /tmp
$ apt-get source mount
$ cd util-linux-2.12r
$ ./debian/rules patch
$ patch -Np1 -i ../util-linux_user_mount.patch
$ ./configure
$ make lib
$ make -C mount
$ sudo chown root:root mount/umount
$ sudo chmod 4755 mount/umount
$ sudo mv mount/umount /bin

automount with udev:

BUS=="usb", KERNEL=="sd*", SYSFS{serial}=="DEF10000CC2DAB6", NAME="%k", run+="/bin/mount /media/usbhdd"

[ view entry ] ( 1355 views )   |  print article
serial (ttyS) over TCP 
First computer where to redirect serial via TCP:

stty -F /dev/ttyS0 raw 9600 -echo
nc 1111 >/dev/ttyS0 </dev/ttyS0

Second computer receiving needs 2 serial's
stty -F /dev/ttyS0 raw 9600 -echo
stty -F /dev/ttyS1 raw 9600 -echo

nc -l -p 1111 >/dev/ttyS1 </dev/ttyS1

Now a programm can connect to /dev/ttyS0 and talks to out first computer.

[ view entry ] ( 1767 views )   |  print article

<<First <Back | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | Next> Last>>