![SSH Google Authenticator 忽略/白名单 ips](https://linux22.com/image/688985/SSH%20Google%20Authenticator%20%E5%BF%BD%E7%95%A5%2F%E7%99%BD%E5%90%8D%E5%8D%95%20ips.png)
我安装了 google authenticator(两步验证),“libpam-google-authenticator”包,尽管它要求每次连接到 SSH 时都输入代码。我想将 localhost 和我自己 ip 列入 google authenticator 白名单,这样我和 localhost 就可以跳过两步验证
或者有没有办法跳过某些 IP 的 SSH 质询?
答案1
在“/etc/pam.d/sshd”中
auth [success=1 default=ignore] pam_access.so accessfile=/etc/security/access-local.conf
auth required pam_google_authenticator.so
然后在“/etc/security/access-local.conf”
#localhost doesn't need two step verification
+ : ALL : 192.168.1.0/24
+ : ALL : LOCAL
+ : ALL : YOURIPHERE
#All other hosts need two step verification
- : ALL : ALL
不要忘记重启 ssh