我想在标题中分享我对这个问题的答案,我很快就找不到了。
如何禁用密码验证有许多主题:
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。
如果不是关于 密码验证 具体来说,您可以强制使用 pam_access.so 把你的 /etc/security/access.conf 看起来是这样的:
pam_access.so
/etc/security/access.conf
+ : myuser : <ip/net here or ALL> - : ALL : ALL