31

I'm having trouble with a USB drive. It used to automount just fine but for some reason those good old days are over. Not only does it not automount but mounting it as a regular user from Nautilus or the terminal gets me a

You do not have the permissions necessary to view the contents of “Elements”.

I can totally mount it as root with

sudo mount -t ntfs-3g /dev/sdb1 /media/Elements

I suspected (and still do) a problem with permissions and, even though Nautilus gave them as being r+w for my user, the admin group, and others, changed them to:

cd /media/Elements
sudo chown -R -v sarah:sarah

which propped up my hopes as the whole output was similar to

changed ownership of 'Volumes' from root:root to sarah:sarah

... but no. Still can't mount unless I sudo mount.

Here's the fstab content:

# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/sda4 during installation
UUID=9a4ff421-d5ab-4d26-a635-f9fd111d7eec /               ext4    errors=remount-ro 0       1
# /boot/efi was on /dev/sda1 during installation
UUID=67E3-17ED  /boot/efi       vfat    umask=0077      0       1
# swap was on /dev/sda5 during installation
UUID=bbf1370f-c5c6-4398-b8ef-7d6092450df8 none            swap    sw              0       0

The disks look like this for fdisk -l ; ls -l /dev/disk/by-uuid/

Device         Start       End   Sectors   Size Type
/dev/sda1         40    409639    409600   200M EFI System
/dev/sda2     409640 488746431 488336792 232,9G Apple HFS/HFS+
/dev/sda3  488746432 490015967   1269536 619,9M Apple boot
/dev/sda4  490016768 968577023 478560256 228,2G Linux filesystem
/dev/sda5  968577024 976771071   8194048   3,9G Linux swap

Disk /dev/sdb: 931,5 GiB, 1000170586112 bytes, 1953458176 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xa635339d

Device     Boot Start        End    Sectors   Size Id Type
/dev/sdb1        2048 1953458175 1953456128 931,5G  7 HPFS/NTFS/exFAT

total 0
lrwxrwxrwx 1 root root 10 maj  8 20:26 072d92f8-9fe6-3e97-8dc8-b974961cd0ea -> ../../sda2
lrwxrwxrwx 1 root root 10 maj  8 20:26 67E3-17ED -> ../../sda1
lrwxrwxrwx 1 root root 10 maj  8 20:26 876e8119-57e2-37e2-bc4a-2a1ddc3d4de4 -> ../../sda3
lrwxrwxrwx 1 root root 10 maj  8 22:35 9092472B924714DE -> ../../sdb1
lrwxrwxrwx 1 root root 10 maj  8 20:26 9a4ff421-d5ab-4d26-a635-f9fd111d7eec -> ../../sda4
lrwxrwxrwx 1 root root 10 maj  8 20:26 bbf1370f-c5c6-4398-b8ef-7d6092450df8 -> ../../sda5

Any ideas?

3

8 Answers 8

11

you need to add user option to your fstab (/etc/fstab) like this

/dev/sdc1    /media/sdc1     vfat  uid=1000,noauto,user           0  0  
/dev/sdd1    /media/sdd1     vfat  uid=1000,noauto,user           0  0  
/dev/sdb1    /media/sdb1     vfat  uid=1000,noauto,user           0  0

Normally, only the superuser can mount filesystems. However, when fstab contains the user option on a line, anybody can mount the corresponding system.

Or if you want any user to mount/unmount the drives use users instead:

/dev/sdc1    /media/sdc1     vfat  uid=1000,noauto,users           0  0  
/dev/sdd1    /media/sdd1     vfat  uid=1000,noauto,users           0  0  
/dev/sdb1    /media/sdb1     vfat  uid=1000,noauto,users           0  0

Only the user that mounted a filesystem can unmount it again. If any user should be able to unmount, then use users instead of user in the fstab line.

Further reading: Fstab - Ubuntu Documentation

NOTE - Find original answer here by Braiam

1
  • This is a USB so most likely not in the fstab file
    – John Orion
    May 8, 2016 at 19:33
11

Ok, I got it. All of the above did not work but I noticed that /media/username was also out of bounds, which was really weird as as was logged in as username. I guess it all has to do with changing the UID a while back. Anyhow, deleting /media/username let it be recreated automatically upon the next plug-in with the right permissions.

4
  • How did you delete the /media/username? Sep 30, 2017 at 5:57
  • 1
    sudo rm -r /media/username
    – Akif
    Dec 31, 2019 at 3:39
  • After several hours, it guided me to the solution!! My USB sticks are mounted on /media, but it had root access only. I've changed it (through right-click and Properties) to a lower priority group which I was a member of and it worked like a charm.
    – testing_22
    Dec 19, 2022 at 0:10
  • I thought this was going to be my problem, but nope... still can't mount external HD via GUI (only with sudo on command line) Jan 23 at 15:15
8

Try this:

Unplugg the usb

Open a terminal:

Press Ctrl+Alt+T

Run it:

exec sudo -i
mkdir /media/Elements
chown -R -v sarah:sarah /media/Elements
chmod -Rf 777 /media/Elements
1
  • 3
    it doesn't work for me, the above applied the same to the usual /media/username/USBNAME where it used to mount, but when I plug the USB a directory /media/username/USBNAME1 is created again without user permission
    – gluuke
    Dec 3, 2018 at 19:36
3

Auto-mounting from terminal with sudo mount -t ntfs-3g /dev/sdb1 /media/Elements mounts as root. Since ntfs does not have explicit permission management on a file-system basis, there's no point in using chown, chmod or chgrp. To mount it so it is user accessible from terminal, you need to use the user mount option, like this:

sudo mount -t ntfs-3g -o user /dev/sdb1 /media/Elements

You might also look into the uid, gid and umask options of the mount command for fine control.

You can create a udev rule, to do that automatically, every time your media is plugged in. Your exact rule depends on whether you want the rule to apply to all usb-media or just this specific stick. But my link to the other answer should get you started.

1

Not sure if it will work because I can't test it myself but here is what I would try.

First make sure that the USB is not plugged in and mounted. Check /media/Elements and see if it exists. If it does I would delete it then insert the USB again and see whats in the /media/ folder. If Elements isn't in there and some other folder is .. then the Label on the USB has changed. If the label on the USB has been removed it will mount the USB as its UUID

If the above still didn't fix anything check again to see that your USB is not plugged in and Create the /media/Elements leave it as root/root but change the permissions on the folder to 777 sudo chmod 777 /media/Elements

Hopefully now when you plug in the USB labeled Elements it will mount in a usable way.

0

If you left have udiskie --tray running as root, it can cause a drive that udisks2 ordinarily would have been mounted within /media/username/ (without any help from fstab) to appear within /media/root/ instead. May happen without the --tray option (which doesn't do anything on trayless ubuntu 18.04 configuration, anyway). This won't, however, explain issues using mount as an ordinary user, where that normally works, and the automounted filesystem was unmounted as root first. udiskie provides one method of turning automount on and off from commandline, though not necessarily the best. Consider "systemctl status/stop/start/mask/umask udisks2.service" where stop disables automount and mask prevents it during subsequent boots.

0

The solution explained in this link (adding -o uid=1000 at the end of the mount command) worked for me.

0

Meet with the same problem for days. Mine is also ntfs, but mount under /mnt.

Checked /etc/fstab, but found the "users" option already there.

Finally I found that you should not keep Window's recycle bin directory in this disk. Nor anything specific for Windows system, like hiber file, pagefile, etc.

New contributor
Proxima Centaur is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .