GNU/Linux Desktop Survival Guide
by Graham Williams
The gnome-volume-manager will automatically mount removable devices as they are connected. It is run as part of the default Debian session, but will also be started, if needed, if you enter the Removable Drives and Media application under Desktop, Preferences menu. Otherwise it will need to be run in your session (add gnome-volume-manager to DesktopPreferencesSessions). The users need to be in group plugdev.
Note that this works best when you run a single X-session at a time (which is the common scenario). If you have two or more users with concurrent X-sessions on different tty's the permissions become an issue. In this situation it is perhaps best to use the Disk Mounter applets to do the mounting.
If you prefer to give gnome-volume-manager a try in the
situation with concurrent users with different X sessions on the one
console, and for trusted users (those in plugdev), you could
use the following /etc/fstab entry:
/dev/usbkey /media/usbkey auto users,gid=plugdev,umask=0002,defaults
The pmount command is the basis of
gnome-volume-manager and is hard coded in the
$ strings /usr/bin/gnome-volume-manager | grep pmount /usr/bin/pmount-hal %h
In order to be able to umount a device, the device needs to have been mounted by the user. This is enforced by checking /etc/mtab and parsing the mount options looking for . needs to be the uid of the user trying to unmount the device. The policy is that if you can run pmount and fulfill certain criteria, you can mount a device. And pumount's policy is that if you are the user who mounted the device and fulfill certain criteria, you can unmount the device.
But if you have two gnome-volume-manager's running, both will get messages from HAL which means that they will race for mounting the device. Ideally one of them should go to sleep!
Copyright © 1995-2006 Graham.Williams@togaware.com