1.修改 ssh 端口,禁止 root用户登录 ssh
# vim +17 /etc/ssh/sshd_config
Port 520520
PermitRootLogin NO
# systemctl restart sshd
2.只允许指定 IP 可以 ssh连接
# vim /etc/hosts.deny
sshd:all:deny
# vim /etc/hosts.allow
sshd:IP:allow
3.普通用户登录ssh后切换到root用户
$ ssh -p 520520 tom@IP
$ su -
本文介绍如何通过修改SSH端口、禁止root用户直接登录、限制特定IP访问等方法来增强服务器的安全性,并提供了具体的操作步骤。
1141

被折叠的 条评论
为什么被折叠?



