Hi,
I'm running Linux OpenSuSE Tumbleweed and I have a certain thumb drive that I want to automount but I want it mounted as read-only. I only want that thumb drive mounted read-only. I want other thumb drives mounted as read-write. The filesystem is FAT32.
I think I can accomplish what I want using a custom udev rule.
I create the file /etc/udev/rules.d/10-usbkey.rules and add the following text:
Where <my serial number> is the actual serial number of the thumb drive.
I grabbed those values from running:
I reload the udev rules by running:
I pop the thumb drive in and it gets mounted as read-write, not read-only. Mount shows:
When I run udevadm test $(udevadm info -q path -n /dev/sdc1) I can see where my 10-usbkey.rules gets loaded and processed, but when I plug in the thumb drive, mount still shows it as read-write, not read-only.
Any ideas what I'm doing wrong?
Thanks!
I'm running Linux OpenSuSE Tumbleweed and I have a certain thumb drive that I want to automount but I want it mounted as read-only. I only want that thumb drive mounted read-only. I want other thumb drives mounted as read-write. The filesystem is FAT32.
I think I can accomplish what I want using a custom udev rule.
I create the file /etc/udev/rules.d/10-usbkey.rules and add the following text:
Code:
SUBSYSTEMS=="usb", ATTRS{manufacturer}=="Kingston", ATTRS{product}=="DataTraveler 2.0", ATTRS{serial}=="<my serial number>", MODE="0555"
I grabbed those values from running:
Code:
root@eugene:[/]# udevadm info -a -n /dev/sdc1 ... looking at parent device '/devices/pci0000:00/0000:00:1d.7/usb5/5-1': KERNELS=="5-1" SUBSYSTEMS=="usb" DRIVERS=="usb" ATTRS{authorized}=="1" ATTRS{avoid_reset_quirk}=="0" ATTRS{bConfigurationValue}=="1" ATTRS{bDeviceClass}=="00" ATTRS{bDeviceProtocol}=="00" ATTRS{bDeviceSubClass}=="00" ATTRS{bMaxPacketSize0}=="64" ATTRS{bMaxPower}=="200mA" ATTRS{bNumConfigurations}=="1" ATTRS{bNumInterfaces}==" 1" ATTRS{bcdDevice}=="0110" ATTRS{bmAttributes}=="80" ATTRS{busnum}=="5" ATTRS{configuration}=="" ATTRS{devnum}=="6" ATTRS{devpath}=="1" ATTRS{idProduct}=="1d00" ATTRS{idVendor}=="13fe" ATTRS{ltm_capable}=="no" ATTRS{manufacturer}=="Kingston" ATTRS{maxchild}=="0" ATTRS{product}=="DataTraveler 2.0" ATTRS{quirks}=="0x0" ATTRS{removable}=="unknown" ATTRS{serial}=="<my serial number>" ATTRS{speed}=="480" ATTRS{urbnum}=="3585" ATTRS{version}==" 2.00" ...
Code:
udevadm control --reload-rules
Code:
/dev/sdc1 on /run/media/spork/SSH KEYS type vfat (rw,nosuid,nodev,relatime,uid=1000,gid=100,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,showexec,utf8,flush,errors=remount-ro,uhelper=udisks2)
Any ideas what I'm doing wrong?
Thanks!
Comment