I am using ubuntu 10.04 LTS – Locid Lynx. I have a requirement to set specific group and permissions for any usb stick file/directories on mount. I have tried overwriting the udev rules. Here is what I have done:
- Created 99-test.rules under /etc/udev/rules.d/ directory with content as SUBSYSTEMS=="usb",GROUP="tomcat6",MODE="0777",NAME="test"
- sudo service udev restart
Now when I mount the usb stick and run 'sudo blkid', it prints
/dev/test: UUID="002A-0AA5" TYPE="vfat"
But the ls -l /media/ gives back
drwx------ 4 admin admin 8192 1969-12-31 16:00 002A-0AA5
It seems that above rule from 99-test.rules is getting applied but getting overwritten afterwards, thus changing group and permissions back to some default value. What is it I am missing here? Do I have to change anything else?
Best Answer
This works for me:
I don't know why, but ACTION== stopped the rule from working at all.
The kernel rule was necessary to avoid a conflict between the stick and the stick's partition, I suspect that was the problem you were seeing.
The symlink is to get rid of an error message about a conflict between the kernel device name and the rule device name. You get a /dev/test that has a symlink to /dev/sdb1, or such.
On 12.04 restarting udev wasn't necessary when testing the rule. Error messages were logged at /var/log/syslog, so I used
tail -f /var/log/syslog
as I mounted the USB drive to watch for them.You may wish to add more tests so you can limit your rule to just the drive(s) you want /dev/test to map to in case you might plug a camera or other device in simultaneously with you memory stick.