1

I am running Gnome 3 on Debian Wheezy. I want to unmount a USB drive without sudo or root privileges. I've googled and found out that there are eject and pumount commands available. However, those commands require the mounted directory to be under the /media directory.

The USB drive is mounted under $HOME/USB/myusb.

How can I unmount it with a non-sudoer user. I also wonder which command Nautilus runs when I press the eject button?

Thanks.

3 Answers 3

1

The eject manpages says that eject can unmount devices corresponding to the device (e.g., /dev/sda1) or the mountpoint (which is in your case $HOME/USB/myusb).

If eject $HOME/USB/myusb is not working. Try eject -v $HOME/USB/myusb to get more information about what is happening.

Tested eject here. It works as expected. Maybe it is a permission problem?

5
  • It did not work. It says $HOME/USB/myusb is not below /media/. Apr 3, 2014 at 20:37
  • My manpage says: "The device corresponding to device or mountpoint is ejected.". I verified that this is working. Can you check your manpage? Which distro do you use? Which eject version do you have? Apr 4, 2014 at 15:27
  • The man page says: Eject allows removable media (typically a CD-ROM, floppy disk, tape, or JAZ or ZIP disk) to be ejected under soft‐ware control. eject version is 2.1.5. Debian Wheezy. Apr 5, 2014 at 17:58
  • Your quote is also in my manpage as first paragraph in section DESCRIPTION. My the 2nd paragraph states that eject can unmount from any location as quoted above. What gives you eject -v? Apr 5, 2014 at 21:50
  • It says $HOME/USB/myusb is not below /media/ Apr 6, 2014 at 13:24
0

Some modern distribution use udiskctl for this:

udisksctl unmount -b /dev/sdc1

(if the usb drive is /dev/sdc).

Nautilus probably use dbus to contact the udisk service for this. (it is what udiskctl do). If you are interested, freedesktop.org as the documentation of the dbus interface.

2
  • It did not work neither, it says $HOME/USB/myusb is busy. However, I don't read/write from it at the moment. lsof gave me a list of processes that might be using that device. Apr 3, 2014 at 21:07
  • udisksctl has a --force option, but you should probably close those processes.
    – Rémi
    Apr 4, 2014 at 4:43
0

You can add an entry for the mount point in /etc/fstab and include the user option to the line

You must log in to answer this question.

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