如何禁用除几个用户之外的每个用户的密码验证
我想分享我对标题问题的答案,但我无法很快找到。
有很多主题如何完全禁用密码身份验证:
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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果不是专门针对密码身份验证,您可以强制使用
pam_access.so
并让您的/etc/security/access.conf
查看像这样: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: