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
扫码