安裝google-authenticator實現動態密碼
阿新 • • 發佈:2019-02-20
CentOS 6.5可以直接安裝
1 、安裝
yum install google-authenticator
注:如果沒有找到,要安裝epel-release源 ,yum install epel-release
或者YUM源安裝
yum -y install mercurial pam-devel
安裝Google Authenticator:
https://codeload.github.com/yangcvo/Google-Authenticator/zip/master
cd libpam-google-authenticator-1.0
make
make install
2、配置
SSH登入時呼叫google-authenticator模組,編輯:/etc/pam.d/sshd
第一行新增:
auth required pam_google_authenticator.so
vim /etc/ssh/sshd_config
新增或修改以下內容:
ChallengeResponseAuthentication yes
UsePAM yes
重啟SSH:
/etc/init.d/sshd restart
3、生成
完成後可通過google-authenticator命令對當前使用者建立隨機密碼,之後選項都選擇yes即可;建立後在家目錄下有個隱藏檔案為.google-authenticator的檔案,記住第一行私鑰
4、下載
然後就可以在手機上安裝google-authenticator客戶端,通過輸入私鑰即可實時顯示密碼以後再遠端登入的時候就會彈出驗證碼,而要輸入客戶端上實時產生的動態驗證碼才能進行登入;
通過給的URL https://www.google.com/chart?chs=200x200&chld=M|0&cht=qr&chl=oxxxauth://txxxxp/xxot@iZ2ze24xxxxxx4398xxxso1Z%3Fsecret%3DCxxxxxxxxxI 掃碼