Use Google-Authenticator to enhance server SSH Login

Source: Internet
Author: User

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.



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.