Use case: I want my screen to auto-lock when I unmount my USB drive. (That part is easy.) What's not so easy: I want the screen lock to require the USB drive and the password when I return.

Thus, is there a way block the screen unlock so that it only allows unlocking when some additional condition is met (test whether a file exists, for instance; I'd create that with the help of udev, that's not the problem; or run a check script and disallow unlocking unless that program exits zero)?

I'm using e17 and Gnome, but solutions for kde/lxde/xscreensaver are appreciated too.

  • 2
    That sounds like you want to look into the direction of PAM, requiring the drive as part of user authentication. Googling turns up pamusb tutorials, but I'm noot up-to-date on PAM to tell whether they're useful, outdated, etc. – Ulrich Schwarz Feb 3 '16 at 18:05
  • Ahh, gnome-screensaver seems to use PAM. Great. I didn't know that. Do the others support PAM, too? (My /etc/pam.d only has entries for gnome-screensaver and xscreensaver.) – Matthias Urlichs Feb 3 '16 at 21:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.