10

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?

  • post the contents of /etc/fstab please. – DopeGhoti May 8 '16 at 19:26
  • Done. I'm really puzzled by this, as it has always worked fine. – Martin V-outer May 8 '16 at 20:47
5

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.

  • How did you delete the /media/username? – Jason Mehmel Sep 30 '17 at 5:57
4

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
  • 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 '18 at 19:36
3

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

  • This is a USB so most likely not in the fstab file – John Orion May 8 '16 at 19:33
2

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.

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.