1. sudo nano /etc/ssh/sshd_config 把22改成你想要的端口, 把前面#去掉 2. 执行下面指令: sudo yum -y install firewalld sudo systemctl enable firewalld sudo systemctl start firewalld sudo firewall-cmd --permanent --remove-service=ssh sudo firewall-cmd --permanent --add-port=你想要的端口/tcp 3. 查看Selinux semanage port -l | grep ssh semanage port -a -t ssh_port_t -p tcp 你想要的端口 4.重加载SSHD / Firewalld sudo firewall-cmd --reload sudo systemctl reload sshd