修改端口
nano /etc/ssh/sshd_config
删掉注释,将22改为2222,保存并退出
防火墙上放开2222端口
iptables -I INPUT -p tcp -m state –state NEW -m tcp –dport 2222 -j ACCEPT
iptables-save
查看2222端口是否已经正常开放
iptables -nL –line-number
重启sshd服务
systemctl restart sshd.service
nano /etc/ssh/sshd_config
删掉注释,将22改为2222,保存并退出
iptables -I INPUT -p tcp -m state –state NEW -m tcp –dport 2222 -j ACCEPT
iptables-save
iptables -nL –line-number
systemctl restart sshd.service