1、使用 root 用户执行以下步骤;只在 CentOS 6.5 下验证。
2、先查看下服务器端口号范围:
# sysctl -a|grep ip_local_port_range
3、修改端口
vi /etc/ssh/sshd_config
Port 58585 #端口号
PermitRootLogin no # 禁止root ssh
4、为新端口开通防火墙规则
iptables -I INPUT 4 -m state --state NEW -p tcp --dport 10089 -j ACCEPT
service iptables save
service iptables reload
5、查看端口使用情况
iptables -L --line-numbers
6、删除22端口的规则
iptables -D INPUT 22
service iptables save
service iptables reload