如何在已经使用公钥的情况下通过sshd启用Google Authenticator?

我在VPS上运行Debian Jessie。

我想要启用私钥和Google Authenticator通过SSH进入服务器。

我启用了

auth需要pam_google_authenticator.so

在/etc/pam.d/sshd和common-auth中

当我使用“terminal”(使用VPS提供商提供的VNC)login时,它正常工作,但是当我login时,它只是让我通过,而不会提示我inputGoogle Authenticator。

我还可以做些什么?

确保你的sshd甚至使用PAM堆栈( sshd_config UsePam选项)。

然后确保您的configuration需要PAMauthentication(如果公钥authentication方法成功,则跳过PAM密码authentication部分)。 您可以通过在sshd_config设置适当的AuthenticationMethods来做到这一点。