SSH访问安全配置方法之一

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 - 
原文地址:https://www.cnblogs.com/testder/p/9201662.html