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.)
I think you'll want ...
), misleading (where did you get uid=1000 and gid=1000?) incomplete (what about the other parts of the fstab line?) and pointless because no sane person would want to mount USB thumb drives by first enquiring there UUID or device number and then editing the fstab as root. And what about automounting a drive which is inserted after the boot? I am looking for a solution myself, it's 2023 and still this fstab solution keeps cargoculting its way in every post mentioning automount usb. Thanks for spreading this bad solution. – bliako Feb 17 '23 at 13:48uid=1000
andgid=1000
correspond with the first user account and group created, so that is cargo-culty, yeah; it'd be better to use your user ID and group ID. I think even another problem that could happen is if the drive isn't inserted at boot, the OS wouldn't load; this question has info on that. – wjandrea Feb 17 '23 at 20:03