Use Google-Authenticator to enhance server SSH Login
For people who need special encryption, I will provide a method for Google-based encryption.
The procedure is as follows:
Preparation:
First, prepare the client on your mobile phone (Baidu download by yourself)
Run the following command:
Date: view system time
Date-s 03/04/2013 (set the system date to January 1, March 04, 2013)
Date-s (set the system time to am)
After modification, execute clock-w to forcibly write the time to COMS!
// Download li
Yum-y install wget gcc make pam-devel libpng-devel
Wget http://fukuchi.org/works/qrencode/qrencode-3.3.1.tar.gz
Tar zxf qrencode-3.3.1.tar.gz
Cd qrencode-3.3.1
./Configure -- prefix =/usr & make install
(Here we download the goole verification to find the address. Here we use it ourselves, and it is estimated that most of them will not be used)
Wget http: // 61.139.99.37/mysoft/Google_authenticator/libpam-google-authenticator-1.0-source.tar.bz2
Tar jxf libpam-google-authenticator-1.0-source.tar.bz2
Cd libpam-google-authenticator-1.0
Make & make install
In the experiment, when the CRT is connected, the IP address is changed.
Next, set logon.
Google-authenticator
Copy the slave code.
Select y
Configure the Logon Settings
Vi/etc/pam. d/sshd
Add auth required pam_google_authenticator.so
ChallengeResponseAuthentication no
Change it
ChallengeResponseAuthentication yes
// Here, selinux is set to disable to avoid problems during login.
Setenforce 0
Service sshd restart
Ssh localhost
Login successful:
[Note]: If you do follow the steps above and do not receive a logon prompt, debug as follows.
Troubleshooting
1 selinux needs to be set to disabled, otherwise SSH will not be able to log on. (Setenforce 0)
Then the service sshd testart
2 google authenticator command line does not generate QR code Solution
Strace-o log google-authenticator
3. When your mobile phone is not around or the apk is not installed, remember the five strings of numbers that appear when you generate the QR code, which is an emergency code,
If you cannot log on, enter any one of them to log on.