root用户登录服务器
22端口修改为22525,22端口也打开,以防新端口设置有问题,登录不上服务器
向防火墙中添加修改的端口
systemctl start firewalld
firewall-cmd --zone=public --add-port=22/tcp --permanent
firewall-cmd --reload
firewall-cmd --zone=public --query-port=22/tcp
重启ssh服务
systemctl restart sshd.service
用新端口登录服务器,如果登录成功把 Port 22注释掉,重启ssh服务即可