Why do I need root privileges to umount a drive at the command line, but not in Nautilus? How to change that?
Nautilus doesn't unmount the device directly; it talks over DBus to a system daemon (udisks-daemon) and asks it to unmount.
The daemon checks if you're allowed to do that, by contacting another system daemon, PolicyKit.
PolicyKit uses the configuration defined in /usr/share/polkit-1/actions/org.freedesktop.udisks.policy
(unless the local system administrator overrides it in /etc/polkit-1
). That file tells PolicyKit that users with active console sessions can detatch drives, so PolicyKit talks to a third daemon, ConsoleKit, to see if you have active console sessions. Logging in via gdm counts as a console session; logging in via ssh doesn't.
There's a command-line tool udisks
that lets you unmount devices without using sudo, using the same mechanism:
udisks --unmount /dev/sdb1
that unmounts the filesystem; I can also detatch the whole device with
udisks --detach /dev/sdb
which makes the LED on my USB key go dark.
The situation might have changed -- in current Ubuntu 10.04 umount works without sudo for USB drives. Generally I think that the command
gvfs-mount -u /media/the_device
(gvfs-mount is in the gvfs-bin package) should always work.
Current answers are deprecated. Try:
gio mount --unmount *mounted location*
get the current mounted partitions with for example:
lsblk | grep media