Set Up Google Authenticator 2FA on a Linux System

In this blog, we will learn how we can set up Google 2FA authentication on a Linux operating system, which means that if you want to be more secure, when you log in to the Linux system after entering the root password, it will also ask for Google 2FA authentication. The process will work on all Debian-based Linux operating systems such as Ubuntu, Kali Linux, Debian, ParrotOS, Linux Mint, etc.
Open Terminal on your Linux machine and update and upgrade your packages, process the command-
sudo apt update && apt upgradeInstall the Google 2FA authentication
sudo apt install libpam-google-authenticator
Now, configure the Google 2FA authentication
google-authenticator
Type y and press enter to continue
You will get a QR code and the secret key to set up on your Google 2FA authenticator Mobile app.

Now install Google Authenticator on your phone from the Google Play Store or Apple App Store.
Now time to scan the QR code; it will add to your Google Authenticator app.
Type the same code on your terminal and press Enter.

You will get 5 emergency scratch codes. If you have lost your phone or your phone is not nearby, then you can also unlock your system with these codes. Save it securely outside of this system, and type Y and press Enter.

It will ask 3 more times for the confirmation; just type Y and press Enter.

Now, clear the terminal, and time to configure the Google 2FA in the system. process the command-
sudo nano /etc/pam.d/gdm-passwordIt will open the nano editor, where we have to add an entry at the bottom.
auth required pam_google_authenticator.so
To save this file, press Ctrl + O, then Enter, and to exit, press Ctrl + X. and close the terminal.
Now it's ready, logout the system, and in login time after entring the root password it will ask the 2Fa authention code, just open the Google authenticator app and enter the code, your system will be unlock.

Curated by Ecency!
Please vote, if you haven't for the New Ecency Proposal.
This post has been manually curated by @bhattg from Indiaunited community. Join us on our Discord Server.
Do you know that you can earn a passive income by delegating to @indiaunited. We share more than 100 % of the curation rewards with the delegators in the form of IUC tokens.
Here are some handy links for delegations: 100HP, 250HP, 500HP, 1000HP.
100% of the rewards from this comment goes to the curator for their manual curation efforts. Please encourage the curator @bhattg by upvoting this comment and support the community by voting the posts made by @indiaunited.
Congratulations @an1info! You have completed the following achievement on the Hive blockchain And have been rewarded with New badge(s)
Your next target is to reach 4000 upvotes.
You can view your badges on your board and compare yourself to others in the Ranking
If you no longer want to receive notifications, reply to this comment with the word
STOPCheck out our last posts: