linux安装谷歌验证器

linux安装谷歌验证器

  • 同步时间
  • 下载程序并编译
  • 设置pam.d/sshd
  • 设置/etc/ssh/sshd_conf
  • 重启sshd
  • 登陆验证

同步时钟

root@li'bin:# service ntpd stop     ===>停止NTP服务
Shutting down ntpd:                  ===>已停止NTP服务
root@li'bin:# ntpdate pool.ntp.org  ===>进行对时
20 Jan 15:09:24 ntpdate[17021]: adjust time server * offset -0.006584 sec ===> 对时成功,相差0.006584秒
root@li'bin:#service ntpd start
  • === 根据自己的服务器情况== 有的服务器是自己调整后的时间===

安装谷歌验证器

root@li'bin:# yum install -y git automake libtool pam-devel

root@li'bin:# wget http://repository.timesys.com/buildsources/l/libpam-google-authenticator/libpam-google-authenticator-1.0/libpam-google-authenticator-1.0-source.tar.bz2

root@li'bin:# tar -jxvf libpam-google-authenticator-1.0-source.tar.bz2  && cd libpam-google-authenticator-1.0 && make && make install
  • 运行谷歌程序
root@li'bin:# google-authenticator   运行   
file (y/n) y       #提示是否要更新验证文件,选择y
attacks (y/n) y    #禁止使用相同口令
(y/n) n          #默认动态验证码在30秒内有效,由于客户端和服务器可能会存在时间差,可将时间增加到最长4分钟,是否要这么做:这里选择是n,继续默认30秒
(y/n) y        #是否限制尝试次数,每30秒只能尝试最多3次,这里选择y进行限制
service sshd restart

设置 pam.d/sshd

  • nano /etc/pam.d/sshd 添加 auth required pam_google_authenticator.so 或者执行下面命令
echo "auth required pam_google_authenticator.so" >> /etc/pam.d/sshd

设置 sshd

  • 修改 /etc/ssh/sshd.conf
ChallengeResponseAuthentication yes 
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值