如何禁用除几个用户之外的每个用户的密码验证

发布于 2024-10-04 04:17:43 字数 496 浏览 0 评论 0原文

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

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

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在这里。

I want to share my answer for question in title, which I can't find quickly.

There many topics how to disable password auth at all:

UsePam yes # it will not be used
ChallengeResponseAuthentication no
PasswordAuthentication no
kbdInteractiveAutentication no

but no topics how to enable for paticular user:

Match User myuser
    PasswordAuthentication yes
    KbdInteractiveAutentication yes

Also useful command to test sshd config is:

sshd -T -C user=myuser,host=127.1,addr=127.1

Please, note that "127.1" will not work on every system, so you may need paste 127.0.0.1 here.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

平生欢 2024-10-11 04:17:43

如果不是专门针对密码身份验证,您可以强制使用pam_access.so并让您的/etc/security/access.conf查看像这样:

+ : myuser : <ip/net here or ALL>
- : ALL : ALL

If it is not about password authentication specifically, you could force usage of pam_access.so and have your /etc/security/access.conf look like so:

+ : myuser : <ip/net here or ALL>
- : ALL : ALL
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文