我正试图加强我们的Google计算引擎VM的安全性,所以我安装并配置了libpam-google认证器来使用两个因素身份验证。我简洁地说:
<set up ssh public/private key>
sudo apt-get install libpam-google-authenticator
google-authenticator # follow steps & scan the code with Google Authenticator on your phone
/etc/ssh/sshd_config
ChallengeResponseAuthentication yes
AuthenticationMethods publickey,keyboard-interactive
/etc/pam.d/sshd
# @include common-auth
auth required pam_google_authenticator.so
sudo systemctl restart sshd.service使用像PuTTY这样的客户机可以很好地工作。
具体来说,我遇到的问题是,当我尝试Google Compute Engine console页面上的HTML按钮时,下面是按钮的图片:

它从不登录,它只是不断地重试报告:
将SSH密钥传输到VM。VM来宾环境已经过时,只支持不推荐的“sshKeys”元数据项。请按照这里的步骤进行更新。
2FA必须阻止GCE传输它生成的ssh密钥,是否有任何方法启用它,还是它与pam_google_authenticator不兼容?
谢谢!
发布于 2017-10-26 07:05:11
这似乎是一个复制- 2因素认证(2步验证)与谷歌计算引擎
他们好像已经知道了,这是我从那个帖子里得到的一些:
除了在/etc/panam.d/sshd中添加一行之外,还应该注释掉@include公共-auth行。所以应该是这样:
auth required pam_google_authenticator.so # from the original instructions
# @include common-auth # commenting out is new...除了更改/etc/ssh/sshd_config中的ChallengeResponseAuthentication属性外,还应该在以下行中添加AuthenticationMethods公钥、键盘-交互式:
ChallengeResponseAuthentication yes # from the original instructions
AuthenticationMethods publickey,keyboard-interactive # this is new...当然,这是在安装libpam-google身份验证器、更改sshd和sshd_config (如前所述)、重新启动ssh/sshd服务以及为帐户设置google身份验证器的常规说明之上。
https://stackoverflow.com/questions/46910590
复制相似问题