When a USB drive (vfat) is connected, the system automatically mounts it on /media/pi/DriveName with permissions set for user pi. Thus each time I need to change something in the drive, I need sudo from other users.

How can I automatically mount drives at say /media/userABC/DriveName with permissions set for user userABC.

Also, I don't want to mount drives using fstab as all the drives irrsepective of their UUID should mount at /media/userABC/DriveName

In nutshell, need to auto-mount USB drives at /media/userABC/DriveName instead of /media/pi/DriveName with permissions (rw) set for userABC without specifying drive's UUID


1 Answer 1


Add an fstab entry which gives the appropriate permissions.

See man fstab for detail.

In general it is better to mount shared devices in /mnt and not use the automount.

You should create the mount point with suitable permissions to allow all users to access. As vfat does not support permissions (AFAIK) these should be inherited, but there are support options for other filesystems.

I don't use vfat, but the following is an example I use for an ext4 partition.

UUID=2dd6c96e-4655-4a04-a8ca-7a5fd39d09bb       /mnt/PiHDD     ext4    defaults,noatime,noauto  0     0
  • By doing what you suggested, only the drive with UUID 2dd6c96e-4655-4a04-a8ca-7a5fd39d09bb will be mounted at /mnt/PiHDD. But as I have stated in the question, I don't want to mount drives using fstab as all the drives irrsepective of their UUID should mount at /media/userABC/DriveName Jul 2, 2016 at 10:45
  • @about99ninjas that was just an example. Since your question was vague it is difficult to be precise. If you want promiscuous mount use the appropriate /dev
    – Milliways
    Jul 2, 2016 at 10:51
  • Actually nope. I just want raspberry to automount each drive in /media/userABC while automatically creating mount points (directories) just like it automatically happens when you connect a new drive. Jul 2, 2016 at 11:48
  • @about99ninjas How is the system to determine what the value of 'userABC' or what the ownership should be when the drive is plugged in? Don't forget that Linux is a multi-user system : so you can't just say 'the logged in user' because there could be more than one logged in user
    – Charemer
    Sep 5, 2017 at 14:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.