Debian – How to make a system lock when the USB pendrive with authentication key is removed

debianlinuxpamusb

Say, I have USB drive authentication up and working. So far, so hoopy. But now I want to take the next step, which is locking the machine when I eject the medium. I know there is udev I can script, but it would be really silly if there's a solution out there which I fail to type the right keywords to find.

So the objective is: lock the screen when the key medium is taken out. Optionally, offer to switch user.

In case anyone cares, I use Debian Sid with WindowMaker, adding gnome-settings-daemon to the mix. I have GNOME programs and use them, just not using the DE itself. I hope there is DE/WM-agnostic solution.

„There is no ready-made solution” counts as a valid answer, too.

Best Answer

This was answered over on Ask Ubuntu. The answers there seem like they would work on many *nixes.

Related Question