USB flash drive has replaced the old portable storage so called "floppy disk". USB flash drive can hold larger data, plus its resistance make it more popular among us. In addition to storing data, USB flash drive can be used to boot the computer and even install operating system from it. Today, I'd like to write a "funny" trick with use USB flash drive as a main actor. Well, login to Ubuntu with USB flash drive!


What the trick does is letting us login to Ubuntu without entering the password as long as the USB flash drive is connected to the computer. OK! Let's get started.

Please make sure that the USB flash drive is connected to the computer and install the required packages:
  • sudo apt-get install pamusb-tools libpam-usb

Run the following command to indentify the USB flash drive:
  • sudo pamusb-conf --add-device ubuntubuzz-usb
You can replace "ubuntubuzz-usb" with anything you want. You'll be asked to save the identity of the USB flash drive, press "Y" and then Enter.


The next step to do is adding login username to the USB flash drive, simply run the following command:
  • sudo pamusb-conf --add-user hok00age
Please replace "hok00age" with your desired username to login. You'll be asked to save your changes, press "Y" and then Enter.


Checking configuration
For the sake of our effort, before trying this out, please check file "/etc/pam.d/common-auth" and make sure that the red boxed text is exist and not commented. (see the picture below)


The last check point to do is running the following command:
  • pamusb-check hok00age
Replace "hok00age" with your username you've added before. If everything goes well, you'll get these output:


You're done! Now you can login to Ubuntu without entering password as long as the USB flash driver connected to the computer.

Regards :)