1

Quick summary: How can I arrange for USB FAT32 thumb drives to be auto-mounted as /media/USER/LABEL, with non-root read/write permissions?

(There are a lot of questions here about automounting USB drives, but I don't see one that's directly relevant.)

I'm running 14.04.4 LTS on an x86_64 system. I'm using the Cinnamon desktop if that matters. I have a FAT32-formatted USB thumb drive. I've run fsck on the drive, and it shows no errors.

Until recently, when I inserted the drive into a USB port it would not auto-mount. It would show up in the output of lsusb, as:

Bus 001 Device 008: ID 058f:6387 Alcor Micro Corp. Flash Drive

I was able to mount it manually, using something like:

sudo mkdir /tmp/usb ; sudo mount /dev/sdg1 /tmp/usb

but that was less than ideal.

I recently installed the usbmount package. After that (and a reboot), when I insert the drive it automatically mounts as /media/usb0:

$ df /media/usb0
Filesystem     1K-blocks  Used Available Use% Mounted on
/dev/sdg1       15712248  9080  15703168   1% /media/usb0
$ 

The problem: I can read everything on the drive, but it all appears to be owned by root and I can't write to the drive without using sudo or equivalent.

What I want to happen is this: When I insert the drive, it's automatically mounted as /media/username/label, where username is my user name and label is the volume label on the drive -- and all files on the drive are owned and writable by my account.

This used to happen automatically, but I don't know how I set it up. Some time ago, I upgraded my workstation from Debian 6 to Ubuntu 14.04. I had the auto-mounting worked the way I want it when I was running Debian 6. I was also using a different desktop environment (some version of Gnome, perhaps?). (The transition from Debian 6 to Ubuntu 14.04 happened to coincide with me not using USB drives as much; now I need to start using them again, so I haven't tried this in a while.)

0

Possible answer:

I'm not sure how to do this for all USB drives universally, but if you have specific drives, you can edit /etc/fstab to set up their mounts how you like them. You can use Disks (gnome-disks), or if you don't mind getting your hands dirty, you can edit it manually. You'll want to set a <mount point> and I think you'll want these options:

uid=1000,gid=1000,dmask=022,fmask=022,users

Run man fstab for more info. There's also some info here on the community wiki.

  • Good information, but there's definitely a way to do it that works for drives in general, and automatically names the mount point based on the drive's label. – Keith Thompson Jul 1 '16 at 22:40
0

I think I've figured out what happened.

I had installed a package called usbmount. With that package installed, inserting a USB drive would automatically mount it as something like /media/usb0, with everything on the drive owned by root. (This is for a drive with a FAT32 filesystem, which for various reasons is what I need to use. I don't know how it would work with a filesystem that actually supports file ownership.)

I've since uninstalled the usbmount. Now when I insert a USB thumb drive, it isn't automatically mounted -- but it does show up in the GUI file manager. (I use the Cinnamon desktop, so my GUI file manager is Nemo; Nautilus does the same thing.) It appears as an entry in the left column, labeled "16 GB Volume"). If I then double-click on that, it's then mounted as, for example, /media/kthompson/EC1C-4374. And if I then use gparted to set the drive's label to THUMB, it's mounted as /media/kthompson/THUMB, which is exactly what I want.

It's likely I didn't notice this because I don't use the GUI file manager very often, and that I incorrectly remembered it being mounted automatically.

It would be nice to have the drive mounted under /media/$USER automatically, but opening a GUI file manager and double-clicking an icon isn't much of a burden. And if it were mounted automatically, it's probably not 100% clear which user should own it; that's probably why usbmount mounts it as root.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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