First, Introduction
The default SSH port for CentOS 7.3 Mini system is TCP 22 port, and for security reasons, the default 22 port is often modified for other ports. General city by modifying the/etc/ssh/sshd_config file, the file inside the "#Port 22" changed to "Port 9999", 9999 this port according to their own needs can be freely written. However, if the centos7.3 mini version of the operating system is only modified here, it is not successful, and the modification will directly cause the SSH reboot to fail. This is due to the fact that CentOS has its own selinux, to solve the above situation of the method to see below.
Second, solve the CentOS change default SSH port failure problem
There are two main ways of solving this:
1. Turn off SELinux
2. Install the Semanage tool and add a SELinux port using the Semanage tool.
2.1 Turn off the SELinux method
Check if SELinux is enabled through Getenforce, if the display is disabled the instructions are off, if the display is enforcing the instructions are enabled.
[Email protected] ~]# Getenforce
Disabled
Permanently close SELinux, enter the/etc/selinux/config file, change the selinux=enforcing to selinux=disabled.
2.2 Secure Semanage tool, use the Semanage tool to add a SELinux port.
Security Semanage Tool Method please Baidu, use Semanage to add a selinux port
Semanage port-a-T ssh_port_t-p TCP 9999
Centos version 7.3mini change ssh default 22 port boot failure problem handling