这是在 Ctrix 的控制台修改,不是通过 SSH 远程到服务器修改的。
更改 SSH 端口
Changing the SSH port is actually pretty simple, open /etc/ssh/sshd_config using your favorite editor and search for the following line:
Port 22
Change 22 with the port number of your choice. Be careful: choose an unused/not-well-known port (at least >1023).
Opening the new port on firewallD
我是修改了系统原来 /usr/lib/firewalld/services/ssh.xml 中的端口
Adding the new port to SELinux
# semanage port -a -t ssh_port_t -p tcp YOUR_PORT_HERE
Of course change YOUR_PORT_HERE with the actual port you chose in the previous step.
但是在 centos 7 中,提示 semanage 不存在。运行下面命令查看这个文件在哪个包里。
yum provides /usr/sbin/semanage
安装这个包
yum install policycoreutils-python-2.5-33.el7.x86_64
