I need some help trying to figure out how to restrict the reading and writing access of usb devices. There are two groups on my system:
- usbreaders: only should have rights to access and read the usb content.
- usbwriters: should have reading and writing rights on the usb content.
I configured the following udev rule to create a symbolic link of the storage device attached:
/etc/udev/rules.d/99-usb.rules
SUBSYSTEMS=="usb",DRIVERS=="usb-storage",SYMLINK+="USB_MASS_STORAGE%n"
Then I configured autofs to mount the usb content with different permissions to two different folders:
/etc/auto.master.d/auto-USB.autofs
MY_USB -fstype=auto :/dev/USB_MASS_STORAGE1
/etc/auto.master
/USBRO /etc/auto.master.d/auto-USB.autofs --timeout=10,noexec,nosuid,uid=root,gid=usbreaders,fmask=127,dmask=027
/USBRW /etc/auto.master.d/auto-USB.autofs --timeout=10,noexec,nosuid,uid=root,gid=usbwriters,fmask=007,dmask=007
+auto.master
But something weird happens. Permissions changes automatically, sometimes owns to usbwriters and sometimes to usbreaders o both folders... really weird.
Could anybody give me ha hand with this? Thank you, really aprecciated!