Table of Contents
How to Set Up Two-Factor Authentication in Ubuntu? Ubuntu is an open source operating system for computers. It is one of the distribution systems of Linux, and is based on the Debian architecture. It is usually run on personal computers, and is also popular on network servers, usually running the Ubuntu Server variant, with enterprise-class features. Ubuntu runs on the most popular architectures, including Intel, AMD, and ARM-based machines.
Ubuntu is also available for tablets and smartphones, with the Ubuntu Touch edition. Two-factor authentication (also known as 2FA) is a method of confirming a user’s claimed identity by utilizing a combination of two different components. Two-factor authentication is a type of multi-factor authentication.
- Computer System with Ubuntu OS
- Any Two-Factor Authentication App in your Smartphone
Install Two-Factor Authentication in Ubuntu
It is really simple to install two-factor authentication application, like Google Authenticator in Ubuntu system. All you have to do is just use below command to install it.
sudo apt install libpam-google-authenticator
Configure Ubuntu OS
Another thing after install Google Authenticator is to configure Ubuntu Linux operating system properly. For this, we need to add a codes in ‘common-auth‘ file. So, to do it, just navigate to etc > pam.d > common-auth. Open the file with any good text-editor and find following below line in it.
auth [success=1 default=ignore] pam_unix.so nullok_secure
Right above that line, add in this one:
auth required pam_google_authenticator.so
Save and close the file.
Configure Google Authenticator
So, now we need to configure Google Authenticator to use it. For this, just enter below command in your OS’s terminal.
Google Authenticator will ask you few questions. According to my suggestion, answer the questions with following below answers.
After answering first question, it will generate a QR Code, Key and Codes. Copy those codes somewhere secure and then answer other questions.
However, you can answer these question according to your requirements as well. It all depends on you.
Don’t close the terminal.
Set Up Two-Factor Authentication in Ubuntu
Well now, you need to install some sort of Two-Factor Authentication application in your smartphone. You can install Google Authenticator App in your smartphone, but according to my suggestion, install Authy app because it is more advanced with cloud storage.
While configuring Google Authenticator in Ubuntu, after first question, it was created a QR Code with Key. Use any Two-Factor Authenticator App and Scan QR code if you can. If are not able to scan QR Code then use Key to manually input it app.
All Done. Restart your Ubuntu operating system to check its effect.
Please Like, Share and Comment your valuable thoughts 🙂
Thanks for patronizing Ultimate Tech. This post is about, "How to Set Up Two-Factor Authentication in Ubuntu?" and last updated on October 2, 2017. I am sure your visit to us must be quite satisfying and in line with your expectations from us. Just in case, it’s not as you expected from us or if you are facing any problem, kindly forward your feedback’s directly to us by leaving a Comment below. And, get assured response from my side. Your feedback’s and suggestions are extremely valuable to us. This Post is written by Harman Singh Hira. There is not any source, if any, then already mentioned so Copying or using this post’s content for your own site is not allowed. If anyone do so, get ready for facing DMCA. Please, if you like this post then share on your social networking sites. Assuring you of our best service always.