我想通过添加另一因素,即密码生成器设备或手机上的密码生成应用程序,来加强我的SSH登录身份验证。默认设置中唯一明显的选项是固定密码和密钥对。我该如何做到这一点?
(如果我使用密码加密码生成器,这将提供两步验证(2FA):密码是“我知道的”,而密码是“我拥有的”。)
(如果我使用密码加密码生成器,这将提供两步验证(2FA):密码是“我知道的”,而密码是“我拥有的”。)
sudo apt-get install libpam-google-authenticator
编辑/etc/pam.d/sshd
以包含该模块:
sudoedit /etc/pam.d/sshd
然后在文件顶部添加以下行并保存:
auth required pam_google_authenticator.so
编辑SSH配置文件以启用挑战:
sudoedit /etc/ssh/sshd_config
,然后将响应身份验证从:
ChallengeResponseAuthentication no
更改为
ChallengeResponseAuthentication yes
然后保存文件。
sudo restart ssh
以重新启动SSH
运行google-authenticator
你需要其中一个来在另一台设备上接收验证码。
auth required pam_google_authenticator.so
ChallengeResponseAuthentication
被替换为KbdInteractiveAuthentication
在/etc/ssh/sshd_config
文件中。 - mark