Ste*_*pan 182 linux ssh login password
在 Linux (Debian Squeeze) 上,我想对某些用户(选定组或除 root 之外的所有用户)禁用使用密码的 SSH 登录。但我不想为他们禁用使用证书登录。
编辑:非常感谢详细的回答!出于某种原因,这在我的服务器上不起作用:
Match User !root
PasswordAuthentication no
Run Code Online (Sandbox Code Playgroud)
...但可以很容易地替换为
PasswordAuthentication no
Match User root
PasswordAuthentication yes
Run Code Online (Sandbox Code Playgroud)
Cak*_*mox 199
尝试Match
在sshd_config
:
Match User user1,user2,user3,user4
PasswordAuthentication no
Run Code Online (Sandbox Code Playgroud)
或按组:
Match Group users
PasswordAuthentication no
Run Code Online (Sandbox Code Playgroud)
或者,如评论中所述,通过否定:
Match User !root
PasswordAuthentication no
Run Code Online (Sandbox Code Playgroud)
请注意,匹配是有效的“直到另一个匹配行或文件末尾”。(缩进不重要)
Tre*_*ley 30
Match
在sshd_config
运作良好。Match all
如果您使用 openssh 6.5p1 或更高版本,您应该使用来结束匹配块。例子:
PasswordAuthentication no
Match User root
PasswordAuthentication yes
Match all
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
189179 次 |
最近记录: |