Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Is it possible to have a USB drive function as a login token?

IE: I turn on my computer, plug the USB drive into my system and the system recognises it and logs me in? Likewise, logs me out should the drive be removed?

Thanks in advance :)

share|improve this question
add comment

2 Answers

up vote 4 down vote accepted

There is an article at LinuxConfig for Linux authentication login with USB device.

accomplished by use of Pluggable Authentication Modules ( PAM ) and some sort of USB storage device such as USB memory stick of Mobile phone with SD card attached.

This authentication technique can be also further expanded into Two-Factor authentication where two authentication methods involving USB token and one-time password can be merged together to produce a greater security.

A summary of actions,

  1. sudo apt-get install pamusb-tools libpam-usb
  2. sudo pamusb-conf --add-device my-usb-stick
  3. sudo pamusb-conf --add-user ubuntu-user
  4. edit a /etc/pam.d/common-auth file
    • auth sufficient pam_usb.so
    • auth required pam_unix.so nullok_secure
    • Before you do any changes to /etc/pam.d/common-auth open-up separate terminal with root access. This is just in case that something goes wrong, and you need a root access to change /etc/pam.d/common-auth back to the original configuration.
  5. su ubuntu-user -- "ubuntu-user" is the username from step 3.
  6. There are some more notes at the end
share|improve this answer
    
Thank you, that was what I was (almost) looking for. Now, if only someone could write a GUI to make the process a little less terminal-mad :P –  Dante Ashton Nov 1 '10 at 21:02
add comment

It's not a regular USB key, but have you looked at YubiKey? It can generate either one-time passwords or just send a normal but long password, and it's recognised as a USB keyboard so it works on pretty much any computer.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.