Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Okay, running Ubuntu 10.04 or Backtrack 5, and I want to create a very complex password with as many bits as possible. But, I doubt I would remember it entirely, and I don't want to look at a notebook to see it everytime I log-on.

So, is it possible to create a complex log-in password, save it on a file (don't know what extension; perhaps a .txt?) on a USB flash drive, and then create a script (?) that will execute transfer or input of the password to the log-in password box whenever the USB flash drive is inserted into the USB port.

Possible, or not?

P.S. And, if possible, would it be possible to encrypt the password so that if someone stole the flash drive, they wouldn't be able to decipher it without hacking it (thus, they'd have to be quite saavy).

share|improve this question
Remember that a password does not protect your computer from unauthorized access, anyone could insert a Live CD and remove this password and copy files. The best solution is a full disk-encrypted system using LUKS – Lekensteyn Jun 5 '11 at 4:26
Doesn't having the password recorded somewhere completely defeat the purpose of having a complex password? And if it's encrypted on the flash drive, then you need an encryption password... which gets you right back to where you started. – nhinkle Jun 5 '11 at 4:28
@nhinkle, this should be used as a second-factor. Which means, you have a password and additionally the key. – nik Jun 5 '11 at 5:27
@nik I know there are systems to use a USB device for a two-factor authentication system, but that's not what he seems to be asking for. The question says he wants to make a really tough password, and then write it down on his USB drive, and then read it off the USB drive into the password box. Thus completely defeating the point of the entire process. – nhinkle Jun 5 '11 at 7:46
@nhinkle, hmmm, in that case we should suggest that he does two-factor rather than plain USB-attach-to-login techniques. – nik Jun 5 '11 at 9:49
up vote 6 down vote accepted

Look at pam_usb.

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

Start at Quickstart.

Also see, One Time Pads: The new authentication model of pam_usb.
(this is with reference to comments on the question; ps: this is a 2007 reference)

even if someone manages to fake your device's manufacturer attributes and to steal your pads, as soon as you authenticate the pads will be regenerated, making the one they have stolen invalid. It's like having a very long random generated one time password, except the fact you don't have to remember such password.

Older reference.
HOWTO: pam_usb login with USB memory stick

This relates to a project of mine, a Single Sign On solution using a usb-memory stick. An advantage is when you have too many passwords to remember, SSO brings this back to one password and one point where you have to login and then use these credentials to access all your applications and resources. For example your webmail, forums etc.


  1. Login locally with your usb memory stick on the console (this howto)
  2. Login locally with your usb memory stick on XDM,GDM,KDM
  3. The possibility to remotely login (via ssh) with the the usb memory stick
  4. A layer build on top of the linux login process (locally/remote) which handles the authenication between the the usb memory stick and the keyserver/ Certificate Authority
share|improve this answer
I've not tried your system, but you have documented it well, and I appreciate the effort in your response. I will probably try it in the future. – H3br3wHamm3r81 Oct 18 '11 at 2:19
Broken links now. – geek1011 Apr 21 at 0:15

Your Answer


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.