将 PAM 与 Google 身份验证器结合使用时,SSH 身份验证会提示两次输入密码

将 PAM 与 Google 身份验证器结合使用时,SSH 身份验证会提示两次输入密码

我正在使用 .ubuntu 在 Ubuntu 服务器上设置双因素身份验证 (2FA) libpam-google-authenticator。我已将 SSH 配置为使用 PAM 进行身份验证,配置如下/etc/pam.d/sshd

auth required pam_unix.so nullok_secure
auth required pam_google_authenticator.so nullok
account required pam_unix.so
password required pam_unix.so
session required pam_unix.so

这是我的/etc/ssh/sshd_config配置:

ChallengeResponseAuthentication yes
PasswordAuthentication yes
UsePAM yes
AuthenticationMethods password,keyboard-interactive:pam

当我通过 SSH 连接到服务器时,系统会两次提示我输入密码,然后再要求 Google Authenticator 提供 OTP。看起来像是pam_google_authenticator.so要求输入密码并将其视为 OTP。

我期望它会询问我的密码一次,然后询问 Google Authenticator 的 OTP。

有没有人遇到过这个问题并找到解决方案?

在此先感谢您的帮助。

相关内容