8

我想分享我对标题中问题的答案,但我无法快速找到。

有很多主题如何完全禁用密码验证:

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。

4

1 回答 1

2

如果它不是专门关于密码身份验证,您可以强制使用pam_access.so并让您/etc/security/access.conf看起来像这样:

+ : myuser : <ip/net here or ALL>
- : ALL : ALL
于 2010-11-22T00:15:05.607 回答