This tutorial will learn a method how to login into Ubuntu 12.10 using USB flash drive. This can be accomplished by use of PAMUSB (Pluggable Authentication Modules USB) and some sort of USB storage device such as USB memory stick, mobile phone with SD card attached. It is compatible with many display managers ((LightDM, GDM, MDM and other DM)
If you’ve set up the USB flash drive, you can use your USB flash drive to store and enter your password automatically. It is secure, automatic and fast. Log-on user name and password are automatically entered as soon as you plug in the USB drive and click Log In. Follow the step-by-step to setup USB flash drive for login into Ubuntu 12.10
Step-by-Step to Setup USB flash Drive for Login into Ubuntu 12.10
Step 1. Install required packages for PAM USB authentication from ubuntu repository. Open terminal and type following command
sudo apt-get install pamusb-tools libpam-usb
Step 2. Insert usb flash drive into usb port and run command pamusb-conf with a name of your USB device. The name can be anything you wish. In this case, we use “ubuntustick”
sudo pamusb-conf --add-device ubuntustick
After completing this step a block of XML code had been added into /etc/pamusb.conf configuration file to define our USB Flash Drive
Step 3. add your ubuntu username (user for login into desktop) into PAM configuration, and at the same time we can define multiple users for one or more USB flash drive.
sudo pamusb-conf --add-user codestream
Step 4. Edit a /etc/pam.d/common-auth file configuration to add pam_usb into a system authentication process.
sudo nano /etc/pam.d/common-auth
Add these line into /etc/pam.d/common-auth
auth sufficient pam_usb.so auth [success=1 default=ignore] pam_unix.so nullok_secure try_first_pass
save and exit
Step 5. At this point, you can login or authenticate with its relevant USB device pluged-in. you can try with following command, in this case my username “codestream”
If success you will get the message like this
* pam_usb v0.5.0 * Authentication request for user "codestream" (su) * Device "ubuntustick" is connected (good). * Performing one time pad verification... * Regenerating new pads... * Access granted.