ænd*_*rük 121 ssh configuration security authentication password
我想只允许来自某个子网的 SSH 密码身份验证。我看到了全局禁止它的选项/etc/ssh/sshd_config:
# Change to no to disable tunnelled clear text passwords
#PasswordAuthentication yes
Run Code Online (Sandbox Code Playgroud)
有没有办法将此配置应用于选定的 IP 地址范围?
Gil*_*il' 182
使用Match块在最后的/etc/ssh/sshd_config:
# Global settings
…
PasswordAuthentication no
…
# Settings that override the global settings for matching IP addresses only
Match address 192.0.2.0/24
PasswordAuthentication yes
Run Code Online (Sandbox Code Playgroud)
然后告诉 sshd 服务重新加载其配置:
service ssh reload
Run Code Online (Sandbox Code Playgroud)
小智 9
你可以加:
AllowUsers user1@192.168.*.*, user2@192.168.*.*
Run Code Online (Sandbox Code Playgroud)
这会改变默认行为,真正拒绝来自所有主机的所有其他用户。匹配块在OpenSsh 5.1及更高版本上可用。
| 归档时间: |
|
| 查看次数: |
223346 次 |
| 最近记录: |