Linux批改ssh端口

服务器环境:CentOS 7.9
工具:Xshell7

//在sshd_config中增加端口
vi /etc/ssh/sshd_config

//重启ssh服务
systemctl restart sshd

//增加防火墙端口的前提是防火墙要关上
systemctl start firewalld

//向防火墙增加一个可凋谢的例外
firewall-cmd --zone=public --add-port="增加的端口"/tcp --permanent

//呈现yes示意防火墙放行胜利
firewall-cmd --permanent --query-port="增加的端口"/tcp

//重启加载防火墙
firewall-cmd –reload

//查看防火墙放行的端口
firewall-cmd --zone=public --list-ports