Create PDF Recommend Print

Automount Volumes (rev2)

Created Monday, 11 January 2010 Created by Nano
Categories News::Sawfish | Frontpage
(0 votes)

for (not just) Sawfish.

If you're like me and use a standalone window-manager instead of a desktop environment, when you might miss the automount functionality. But of course you can easily have that, too.

My approach is, to use pmount (homepage). After you have installed pmount, you first setup an udev rule for it.

As root, create a file called /etc/udev/rules.d/automount.rules with the following content:

1
2
KERNEL=="sd*", ACTION=="add", RUN+="/usr/bin/pmount --umask 000 %k"
KERNEL=="sd*", ACTION=="remove", RUN+="/usr/bin/pumount %k"

Explanation:

KERNEL=="sd*" -> This describes the device-nodes to react upon. /dev/sd* device-nodes are usually, USB, SCSI and S-ATA drives. (And anything else technically SCSI based). Of course you can add rules for not just a group of devices, but also a specific one, say KERNEL=="sr0" which would then only take effect for your disc-writer. (on recent kernels, on older ones it's hd?, eg hdb).

ACTION=="add"/"remove" -> Which action to react upon. "add" is obviously run when a device is plugged-in, and "remove" than it's unplugged.

RUN+="…" -> The command to run, if KERNEL and ACTION match the currently inserted device.

Since we're not using Windows, we don't need to restart our machine to let the changes take effect, as root, issue the following command:

1
udevadm control --reload-rules

The device will be mounted in /media/[device-node], so - for example - /dev/sdc1, will be mounted to /media/sdc1

If you want to configure mount-options of the devices, issue:

1
pmount --help

And adjust the RUN+="…" part of the rule to your needs.

This way you don't need a plugdev group or to make pmount setuid-root or something like that, to let normal users mount any matching device.

Have  Fun.

Add comment


Security code
Refresh