Check whether semanager is installed and execute the following command: rpm -qa | grep semanager.
If it is not already installed, execute the following command: yum-y install policy cores-python.
2 modify ssh configuration file
vi /etc/ssh/sshd_config
(1) Remove the comment of Port=22 first, and then change port 22 to the port you want to change.
3 modify SELinux
Semanageport-l | grepsh// Use the following command to view the currently allowed ssh ports in SElinux:
? (if there is no samanager command, yum installation: yum-y install policy cores-python)
4 add 20000 ports to? SELinux
semanage port-a-t ssh _ port _ t-p TCP? 20000
semanage port -l | grep ssh? //Then confirm whether to add.
If successful, the output will be:
ssh_port_t tcp 20000,22
5 restart the ssh service and execute the following command: service sshd restart or systemctl restart sshd.service
6. Add the firewall port number