====== sshd-config常见配置 ====== ===== 只允许特定的用户从某个网段访问root ===== 默认情况下,root是不允许密码直接登陆的,我们可以特殊配置 /etc/ssh/sshd_config 文件让特定的ip可以访问root。 Match Address 192.168.100.0/24,192.168.1.0/24,你的客户端IP PermitRootLogin yes PasswordAuthentication yes 然后执行 sudo sshd -t # 检查语法,没有输出就是正常的 sudo systemctl restart ssh
Match Address 192.168.100.0/24,192.168.1.0/24,你的客户端IP PermitRootLogin yes PasswordAuthentication yes
sudo sshd -t # 检查语法,没有输出就是正常的 sudo systemctl restart ssh