将 linux 服务器设置指定 IP 指定用户登录系统,在某种程度上提高了一定的安全性。 步骤: 环境: [root@localhost ~]# cat /etc/redhat-release CentOS Linux release 7.4.1708 (Core)

1:查看系统 SSH 版本:

[root@localhost ~]# ssh -V OpenSSH_7.4p1, OpenSSL 1.0.2k-fips 26 Jan 2017

2:更改 ssh 服务配置文件 [root@localhost ~]# vi /etc/ssh/sshd_config AllowUsers root@192.168.180.30 # 添加以下一行

3:重启 SSH 服务 [root@localhost ~]# systemctl restart firewalld.service

4:测试验证: 最好用两台服务器进行测试,对比。