I spent 6 hours yesterday testing @Ingo Blackman's answer to the Unix and Linux Stack Exchange article,
[Automounting USB sticks on Debian
When I use a udev rule ACTION=="add" and RUN+="/bin/ln -sf /media/autousb/%k /media/frank/usb/%k" , shown immediately below:
# Add symlink /dev/usbdisks/<label> to /dev/sd[a-z][1-9]
# for automounter support
ACTION=="add", KERNEL=="sd*", ENV{DEVTYPE}=="partition", \
ENV{ID_BUS}=="usb", \
SYMLINK+="usbdisks/%k", MODE:="0660", \
RUN+="/bin/rm /media/usb/%k", \
RUN+="/bin/ln -sf /media/autousb/%k /media/frank/usb/%k"
# Some FileSystems emit a "change" event when they are unmounted.
# UDEV seems to delete the device symlink in this case :-(
# So we need to re-create it here
ACTION=="change", KERNEL=="sd*", ENV{DEVTYPE}=="partition", \
ENV{ID_BUS}=="usb", \
SYMLINK+="usbdisks/%k", MODE:="0660"
# When device is removed, also remove /media/usb/<...>
ACTION=="remove", KERNEL=="sd*", ENV{DEVTYPE}=="partition", \
ENV{ID_BUS}=="usb", \
RUN+="/bin/rm /media/frank/usb/%k"
the udev or autofs service creates the directory /media/autousb with 755 permission rather than 777 permission so that udev or autofs cannot create regular files or soft links inside /media/autousb.
May I ask how to fix this?
My simplistic hypothesis is that since I am Ubuntu 16.04 user frank belonging to the group plugdev along with user root, the above udev add rule should work if I change use /media/autousb to /media/frank/autousb.
Any help is greatly appreciated.