I have more time to play with this now. I’m trying to configure my specific thumb drive to automount as read-only, but I’m struggling with finding documentation that shows me how to do this. Here’s the udev rule I currently have (/etc/udev/rules.d/10-usbkey.rules)
KERNEL!="sd[a-z][0-9]", GOTO="media_by_serial_auto_mount_end"
# See if it's the usb key we want to use, and if it's not, end.
SUBSYSTEMS!="usb", ATTRS{manufacturer}!="Kingston", ATTRS{product}!="DataTraveler 2.0", ATTRS{serial}!="<my serial number>", GOTO="media_by_serial_auto_mount_end
# Import FS infos
IMPORT{program}="/sbin/blkid -o udev -p %N"
# Get a label
ENV{dir_name}="%E{ID_FS_LABEL}"
# Global mount options
ACTION=="add", ENV{mount_options}="relatime"
# Filesystem-specific mount options
ACTION=="add", ENV{ID_FS_TYPE}=="vfat", ENV{mount_options}="$env{mount_options},ro,nosuid,nodev,uid=1000,gid=100,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1$
# Mount the device
ACTION=="add", RUN+="/bin/mkdir -p /run/media/%E{dir_name}", RUN+="/bin/mount -o $env{mount_options} /dev/%k /run/media/%E{dir_name}"
# Clean up after removal
ACTION=="remove", ENV{dir_name}!="", RUN+="/bin/umount -l /run/media/%E{dir_name}", RUN+="/bin/rmdir /run/media/%E{dir_name}"
# Exit
LABEL="media_by_serial_auto_mount_end"
I haven’t tried this rule yet, but it might work. The probably is the mount locations. I don’t want it mounting to /run/media/%E{ID_FS_LABEL}. I want it mounting to /run/media/<username>/%E{ID_FS_LABEL}, for example:
/run/media/spork/SSH\ KEYS
Can someone help me figure out how to always mount just this specific thumb drive as read-only and not read-right? Thanks!