1、编辑配置文件

vi /etc/ssh/sshd_config

2、加入限制

AllowUsers root@x.x.x.x

3、重启服务

/bin/systemctl restart sshd.service