It is believed that changing SSH port number in CentOS 7 will actually improve its security quotient. The main idea behind this is the SSH port number, which is by default 22, is known to all, it is never safe from hackers. So, when this port number is changed the server is made more secure and the hackers are not likely to know which port the SSH will use for communications. Although this method is not foolproof, it is effective to a certain extent.
Hackers are equipped to detect connecting ports using some scanners and tools. So, this is an attempt to deter them. There is an area however where this will make the server bullet-proof; i.e. bots. The most effective way to secure the SSH server
is to use the password-less login measure using encryption and certificates. This means that only machines which own the encryption key can access the server. A second way to configure your server firewall to is to allow the SSH port to connect to only those IP addresses which are white-listed. To change default port number on the CentOS you may use the command: sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak for backing up current SSH configurations. This is important in case something goes wrong and you need to retrieve the original file. To open default SSH configuration file you must use the command: sudo vi /etc/ssh/sshd_config. This command will use the vi editor for changing file contents. Once the file has opened, you may changes to any port number.