天天看點

安裝GOOGLE-AUTHENTICATOR驗證器

安裝GOOGLE-AUTHENTICATOR驗證器

1.安裝epel源

rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

2.安裝git級二維碼工具

yum install -y git qrencode

3.安裝開發包工具

yum groupinstall -y "Development Tools"

4.安裝google-authenticator

git clone https://github.com/google/google-authenticator.git

cd google-authenticator/libpam/

sh bootstrap.sh

./configure && make && make install

cp -v /usr/local/lib/security/pam_google_authenticator.so /lib64/security/

5.生成基于技術的認證token(可以忽略時間錯誤)

google-authenticator --counter-based --force --window-size=1 --no-rate-limit

6.更改ssh級pam設定

## 修改PAM

vi /etc/pam.d/sshd

auth required pam_google_authenticator.so

## 修改SSH配置

ChallengeResponseAuthentication yes

UsePAM yes

service sshd restart

修改ssh的鑒權方式,改為鍵盤互動。

注意: 這裡要把應急驗證碼記錄下,防止驗證壞掉以後無法登陸,也可以把ssh的公鑰下載下傳下來做備用登陸方式

本文轉自 shouhou2581314 51CTO部落格,原文連結:http://blog.51cto.com/thedream/1716647,如需轉載請自行聯系原作者