I mount a USB HDD used for intermittent plugin backup via the fstab entry:

# <file system>                           <mount point> <type>  <options>                                                                        <dump> <pass>
UUID=cd9f3fc4-f67f-42c4-8190-21d2766d2b65 /mnt/Bu-ehd2  ext4    rw,nosuid,noexec,nodev,noauto,nofail,relatime,user_xattr,acl,comment=x-gvfs-show 0      2

To unmount, sudo umount /mnt/Bu-ehd2 works, but trying to unmount as a regular (non-root) user:

$ umount /mnt/Bu-ehd2
umount: only root can unmount UUID=cd9f3fc4-f67f-42c4-8190-21d2766d2b65 from /mnt/Bu-ehd2

Why it is so is covered by @MariusGedminas' answer on AU, but not how to circumvent the usage restriction on umountwithout sudo.

  • Adding user to the mount options does not help.

  • Adding users does help but unmounting by any user becomes possible even after mounting was done based on an /etc/fstab entry. A possible but poor solution.

  • Adding uid=1000,owner breaks the mount process altogether with:

Error mounting system-managed device /dev/sdc1:

Command-line `mount "/mnt/Bu-ehd2"' exited with non-zero exit status 32: mount: wrong fs type, bad option, bad superblock on /dev/sdc1,...

I checked:

$ df -l | grep Bu-ehd2
/dev/sdc1        192162396     60744 182317284       1% /mnt/Bu-ehd2

$ ls -lAsF /dev/disk/by-uuid | grep sdc1
0 lrwxrwxrwx 1 root root 10 Mar 29 11:24 cd9f3fc4-f67f-42c4-8190-21d2766d2b65
-> ../../sdc1

$ stat /mnt/Bu-ehd2 | head -4
File: ‘/mnt/Bu-ehd2’
Size: 4096          Blocks: 8          IO Block: 4096   directory
Device: 821h/2081d  Inode: 2           Links: 3
Access: (0770/drwxrwx---)  Uid: ( 1000/someuser)   Gid: (    0/    root)

$ stat /dev/sdc1 | head -4
File: ‘/dev/sdc1’
Size: 0             Blocks: 0          IO Block: 4096   block special file
Device: 5h/5d   Inode: 176539      Links: 1     Device type: 8,21
Access: (0660/brw-rw----)  Uid: (    0/    root)   Gid: (    6/    disk)

$ blkid | grep Bu-ehd2 # yields nothing on /dev/sdc1 when actually 
$                      #+ mounted on `/mnt/Bu-ehd2`

Q: Is unmouting as a regular user impossible due to the fact that the mounted device is owned by root ? If so, how do I make the device umountable by someuser just by issuing cmd umount /dev/sdc1 ? Ideally that would be by making someuser the owner of its own external usb HDD device.

Note: I prefer not to resort to sudo visudo in order to write a sudo-exception rule for every different user, for umount. It would still force every someuser to type sudo umount /mnt/Bu-ehd2 instead of just umount /dev/sdc1 anyway.


3 Answers 3


Unless root, a user can not umount any filesystem mounted by some other user.

If you have used the user option in mount (/etc/fstab), you can check the output of mount command, you will see the user= showing the user who has mounted the filesystem. Only that user (and root) can use umount to unmount the filesystem.

There are hacky ways to do unmounting as a different user but i don't think there is any direct umount way.

Here is a function (based on OP's idea) that will run umount or gvfs-mount based on EUID. This could be put in /etc/bash.bashrc so that it will be available on all user's interactive shells:

unmount () {
    if [[ "$#" -eq 1 ]]; then
        { [[ "$(id -u)" -eq 0 || "$1" =~ ^-.* ]] && "$(command -v umount)" "$1" || gvfs-mount -u "$1" ;}
        printf "Usage: unmount [option -h [|-V]|mount-point|device-path]\n"
  • ok. I get it. @MarcelStimberg provides an old but valid workaround from cli in askubuntu.com/questions/405/… , in the form of gvfs-mount -u /media/the_device. But just introducing user in the mount options doesn't help (see OP) and introducing uid=1000 (for instance) breaks the fstab entry (see OP), at least for an ext4 FS...
    – Cbhihe
    Mar 29, 2016 at 11:15
  • @Cbhihe If you use user, then the user mounted it can unmount it..not any random user..also i have said there is no direct umount way..
    – heemayl
    Mar 29, 2016 at 11:21
  • ...a slight misunderstanding perhaps. I am indeed talking about a user unmounting the USB ext4 fs it previously mounted based on the fstab entry. Or is it that when there is an fstab entry, the usb FS is actually mounted by root from within the non-root user session ? In any case placing user in the options and letting fstab do its job does not allow me to unmount as non-root. I have the feeling that mounting according to an fstab entry is tantamount to root mounting the FS. True or False ?
    – Cbhihe
    Mar 29, 2016 at 12:40
  • 1
    True..mount does not depend on session, it depends on user..if root has mounted something , only root can umount it..also if a non-root user has mounted something, no other non-root user except it can umount it (root can obviously)....also i am talking about mount - umount here, not any other tools as tools like udisks manipulate the device directly and offer services via DBus..
    – heemayl
    Mar 29, 2016 at 12:46
  • +1. Got it despite being thick today. Finally I just went ahead and included users in the /etc/fstab entry mount options. It's a poor cop-out, a bit like leaving yr house door wide open so you can be sure to always be able to get in if you forget yr key... So can anyone else. Another better way would be to (just for someuser) "overload" (borrowed terminology!) the umount cmd with a small function placed in ~/.profile and in ~/.bash_profile (or in ~/.bash_login), which would catch the error message and redirect $1 to be handled by gvfs-mount -u $1. Just an idea.
    – Cbhihe
    Mar 29, 2016 at 13:22

You can use udisksctl to unmount without root privileges:

udisksctl unmount --block-device /dev/sdc1
  • yes Serg, thanks. But it is already well covered by gvfs-mount -u /dev/sdc1 in comments to heemayl's answer above. I see the two approaches as equivalent even as udisksctl is "finer grained" than the simpler gvfs-mount ...
    – Cbhihe
    Apr 3, 2016 at 6:49

Use udisksctl mount/unmount -b /dev/sdX. To use mount or umount without root privileges you need to edit /etc/sudoers file with visudo and add the lines:

username ALL=(ALL) NOPASSWD: /bin/mount, /bin/umount

Then reboot.

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.