mathr / blog / #

/etc/fstab line for less sucky vfat USB pen drive

I got sick of having to mount my vfat USB flash drive stick as root, and chmod/chown files after moving them as root. So I investigated udev. Turns out I don't need to write a udev rule, but just add a line in /etc/fstab:

/dev/disk/by-id/usb-USB_DISK_Pro_AA04012700008623-part1 /media/pen/     vfat    user,noauto,uid=claude,gid=claude,dmask=077,fmask=177   0       0
/dev/disk/by-id/
udev creates uniquely named symlinks for each drive out of the box.
user
allow non-root users to mount
noauto
don't mount at boot
uid, gid
the owning user and group of all files
dmask, fmask
permissions to remove from directories and files