Linuxdoc Linux Questions
Click here to ask our community of linux experts!
Custom Search
Next Previous Contents

5. The long wait for unmounting

Some of you may be eyeing that 60 second timeout and thinking, that's a long time to wait to eject a floppy.. Maybe I'll just sync the disks and pop it out mounted and nobody will notice. Let me suggest saner alternatives. First of all, you can change the timeout. But that could be a little inefficient; telling the system to unmount stuff after only 15 seconds or whatever. Depending on your setup, you may be able to simply run the umount command as a normal user. But there is actually a way to ask the automount program to umount. If you send (with the program kill) the signal SIGUSR1 to the automount process, it will unmount everything it can. But before people start making unmount buttons on their window managers, there's a little problem.

The automount process is run by root, and it will only accept signals from root. Half of the reason you're probably doing automounting is so you can mount and unmount without being root. It would be easy to make a suid-root C program which does the dirty deed. However, by using sudo it is possible to allow users to send the proper kill signal. The only problem is that sudo will not let you use to process subcommands, which you would have to do to find the current PID. You should have a program called killall, which will let you do this:

ALL     ALL=NOPASSWD:/usr/bin/killall -USR1 automount
Otherwise, you would have to allow your users to send -SIGUSR1 to all processes. That has various effects on programs; it will recycle some window managers, but kills xemacs. So here's hoping there's no buffer overruns in killall...
Next Previous Contents