To change the port number that OpenSSH listens on in CentOS Linux 5/6, you will need to edit the OpenSSH server configuration file.
/etc/ssh/sshd_config
file in a text editor.sudo nano /etc/ssh/sshd_config
Port
and change the port number to the desired value. For example, to change the port to 2222:Port 2222
Save and close the sshd_config
file.
Restart the OpenSSH server to apply the changes:
sudo service sshd restart