7

Is it possible to get Ubuntu to lock and unlock itself, if a particular USB stick is attached?

For example; I sit down at my laptop; I plug the USB stick in and the system unlocks and presents itself.

I take the USB stick out, and the system locks and cannot be unlocked without that particular USB stick.

Is there any way to do this, my friends?

2 Answers 2

1

I don't know about any products (like Predator for Windows) but I have seen this solution which appears to work:

Use a script to loop&sleep filtering to grep for info specific to your USB stick. When you get a match, kill the screensaver.

Be sure to have the sleep timer a LOT shorter when the USB is removed than when the USB is inserted.

When you are away (USB removed) all your machine has to do is fanatically cycle through lsusb looking for your return (USB inserted).

EDIT: A working example of this to get you on your way can be found at http://www.techienote.com/2011/03/lock-unlock-ubuntu-desktop-using-usb-drive.html

2
  • 1
    Yuck, it would be better to have udev trigger an event on USB insertion/removal that would read someone off the key for verification.
    – tgm4883
    Sep 22, 2011 at 19:55
  • Thank you, my friend! Though I have to say, I was rather hoping there was a simpler, easier program for it... Still, there's nothing like being baptised by fire when it comes to cron :P Sep 24, 2011 at 10:48
0

Pamusb is a much easier solution:

pam_usb provides hardware authentication for Linux using ordinary USB Flash Drives.
It works with any application supporting PAM, such as su and login managers (GDM, KDM).

2
  • Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference.
    – Kaz Wolfe
    Sep 27, 2014 at 0:14
  • Andrea Luzzardi's main project seems unmaintained (see about on GH), pamusb.org point to deprecated links, and libpam-usb/pamusb-tools are only available through PPA Jun 24, 2022 at 19:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .