In this guide, I will be showing you how you can change the SSH port on CentOS 7.
To do this, you will need to navigate to the ssh config file. You can do this with your favourite text edit (e.g nano)
sudo nano /etc/ssh/sshd_config
Once in the file, you will see where it says:
Change the number 22 to the port of your choice. Once you have done this, save and exit (Ctrl + O and then Ctrl + X in nano).
You can then enter this to let SELinux know of the change and to allow it through the firewall. (Replace #yournewport with the port you entered above)
semanage port -a -t ssh_port_t -p tcp #yournewport
You can then restart your ssh server to apply the change.
systemctl restart sshd
All done! You can now connect using the amended details.