Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I can't understand why, when I tried plug-in external USB driver in Ubuntu 12.04, I see next message:

Error mounting: mount exited with exit code 1: helper failed with:
mount: only root can mount /dev/sdb1 on /media/sdb1

Here is content of /etc/fstab:

# /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>
proc                                       /proc           proc  nodev,noexec,nosuid       0  0  
# / was on /dev/sda1 during installation
UUID=5f5d330f-d5f2-4157-9496-94f1dce2f181  /               ext4  errors=remount-ro         0  1  
# swap was on /dev/sda5 during installation
UUID=84747ef4-6f50-49bc-9df1-fcba364ba299  none            swap  sw                        0  0  

/dev/fd0                                   /media/floppy0  auto  rw,user,noauto,exec,utf8  0  0  
/dev/sdc1                                  /media/sdc1     vfat  uid=1000,noauto           0  0  
/dev/sdd1                                  /media/sdd1     vfat  uid=1000,noauto           0  0  
/dev/sdb1                                  /media/sdb1     vfat  uid=1000,noauto           0  0

And this is my current sudo fdisk -l:

Disk /dev/sda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders, total 312581808 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
Disk identifier: 0x000e28b8

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048   310484991   155241472   83  Linux
/dev/sda2       310487038   312580095     1046529    5  Extended
/dev/sda5       310487040   312580095     1046528   82  Linux swap / Solaris

Disk /dev/sdb: 993 MB, 993001472 bytes
2 heads, 1 sectors/track, 969728 cylinders, total 1939456 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
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1             133     1939455      969661+   6  FAT16

Disk /dev/sdc: 4009 MB, 4009754624 bytes
16 heads, 32 sectors/track, 15296 cylinders, total 7831552 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
Disk identifier: 0xd8e1f237

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1   *          32     7831551     3915760    b  W95 FAT32

sdc and sdb - there are external usb drivers.

Can I solve this trouble and mount all external usb drives automatically?

share|improve this question
    
Check your permissions. Post results of: ls -l / | grep media and ls -l /media | grep sd –  dan08 Aug 23 '13 at 20:11
    
@dan08 It all as drwxr-xr-x 2 root root 4096 Jun 14 11:04 bin; drwxr-xr-x 3 root root 4096 Aug 21 18:47 boot; drwxr-xr-x 2 root root 4096 Jun 9 14:17 cdrom; I don't know how to divide this line to parts –  nazar_art Aug 23 '13 at 20:14
    
@dan08 of course they all exist, as drwxr-xr-x 2 root root 4096 Aug 20 22:00 sdc1/. –  nazar_art Aug 23 '13 at 20:21
add comment

2 Answers 2

up vote 4 down vote accepted

You need to add the user option to your fstab

/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

The user option allows any user to mount a device, as said in the man:

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

Man page:

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.

Note: the user option also implies noexec, nosuid, and nodev, so if you need those options, you'll need to add their counterparts. For example, if you're going to need to execute binary files from the drive, you should add the option exec, so your options would be uid=1000,noauto,user,exec, and the same goes for the other two.

Further reading: Fstab - Ubuntu Documentation

share|improve this answer
add comment

If you have an entry for a device in /etc/fstab, it will prevent the Ubuntu automatic mounter from mounting that device when plugged in.

I just tested this on my system which was automatically mounting my thumb-drive upon insertion:

// insert thumb-drive
$ grep gvfsd /proc/mount
gvfsd-fuse on /run/user/msw/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,user=msw)

When I added the line

/dev/sdb1   /mnt    vfat    noexec 0 0

to /etc/fstab and inserted the thumb-drive, there was a flurry of activity by the process gvfsd-udisks2-volume-monitor which included opening and reading /etc/fstab (as shown by strace). The thumb-drive did not mount.

When I changed /etc/fstab by adding one character to comment out the entry:

#/dev/sdb1   /mnt    vfat    noexec 0 0

gvfsd-udisks2-volume-monitor became busy again and mounted the thumb drive. I didn't have to take out the thumb-drive and reinsert it, I didn't have to send a signal to gvfsd, so the automatic mounting daemon seems to be watching /etc/fstab for changes.

I don't know why it behaves this way, but the test was simple and repeatable.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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