码迷,mamicode.com
首页 > 其他好文 > 详细

centos 6 SSH配置Google Authentication 验证

时间:2016-10-17 00:13:52      阅读:158      评论:0      收藏:0      [点我收藏+]

标签:

创建工作目录: mkdir google-authentication

1. 安装二维码生成依赖

#wget http://fukuchi.org/works/qrencode/qrencode-3.3.1.tar.gz

# tar xf qrencode-3.3.1.tar.gz

#cd qrencode-3.3.1

#./configure --prefix=/usr && make && make install

 

2. 安装Google-authenticator

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

#cd google-authenticator/libpam/

#./bootstrap.sh && ./configure && make && make install

#执行google-authenticator命令配置

技术分享

 

3. 配置sshd使用google-authenticator验证

  3.1 复制pam动态库到默认加载目录

    #cp /usr/local/lib/security/pam_google_authenticator.so /lib64/security/

  3.2 在/etc/pam.d/sshd中添加使用google_authenticator,首行添加

    auth       required pam_google_authenticator.so

  3.3 编辑/etc/ssh/sshd_config

    ChallengeResponseAuthentication yes

  3.4 重器sshd: service sshd restart

 

4. 手机下载Google 身份验证器,输入第2步中生成的secret key和用户名,配置好,然后就会每30s生成一个验证码。

  我这里是设置的root,因为我第2步是在root家目录下设置的google-authenticator,如果是其它用户,请切换到其它用户目录再执行google-authenticator命令生成秘钥。

 

5. 在其它机器上登录这台服务器:就会要求先输入验证码,这个时候,在手机上查看验证码,输入,然后再输入用户密码,都验证通过,才可以登录。

技术分享

 

centos 6 SSH配置Google Authentication 验证

标签:

原文地址:http://www.cnblogs.com/zhaojonjon/p/5968047.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!