我想分享我对标题中问题的答案,但我无法快速找到。
有很多主题如何完全禁用密码验证:
UsePam yes # it will not be used
ChallengeResponseAuthentication no
PasswordAuthentication no
kbdInteractiveAutentication no
但没有主题如何为特定用户启用:
Match User myuser
PasswordAuthentication yes
KbdInteractiveAutentication yes
测试 sshd 配置的有用命令是:
sshd -T -C user=myuser,host=127.1,addr=127.1
请注意,“127.1”并非适用于所有系统,因此您可能需要在此处粘贴 127.0.0.1。