我需要让用户使用不同的身份验证方法登录 CentOS 系统。有些使用密码,有些使用公钥。
我遵循了这里提到的方法: How can I setup OpenSSH per-user authentication methods?
但是,我没有成功基于密码登录。
在 sshd_config 文件中,我有:
AuthenticationMethods keyboard-interactive,publickey
PasswordAuthentication no
Match User newton
PasswordAuthentication yes
Match all
Run Code Online (Sandbox Code Playgroud)
更新:我发现问题仅在我通过谷歌身份验证启用了 2FA 并且我有以下线路时:
AuthenticationMethods keyboard-interactive,publickey
Run Code Online (Sandbox Code Playgroud)
虽然对于用户 newton,我已经设置了密码身份验证,但我看到以下错误:
[root@localhost]# ssh newton@50.39.213.152
Permission denied (publickey).
Run Code Online (Sandbox Code Playgroud)
任何建议表示赞赏。