This article explains how to add Google Authenticator to your centos 7 system to enable double authentication for ssh to improve the security of ssh services when logging in with a password.
1. Install Google Authenticator on Linux
First we need to enable the epel repository
|
|
Install the relevant dependency libraries.
|
|
Install google authenticator.
After the installation is complete, initialize the configuration by running the following command directly to start the initial configuration.
|
|
The QR code generated during the initialization process needs to be scanned by the mobile client’s google authenticator
app. Then it can be added to a dynamic password that changes once every 30s.
There is also a generated emergency scratch codes
remember to save carefully, this is used for emergency login when the phone is lost.
Other options according to their needs to choose, do not know, then the default choice y
can be.
2. Enable google authentication for ssh
|
|
Modify the ssh configuration file /etc/ssh/sshd_config
and adjust the following parameters to yes
.
|
|
Finally, we just restart the ssh service.
|
|
3. Effect
After reboot, if you need to use the password again for ssh login, you need to enter the Google Authentication Code before you can enter the password again.