CentOS - How to Change the Default ssh Port Number in Linux

By default, ssh listen to port 22 for connections. Attackers will use a port scanner software (such as nmap) to scans for an open port. Normally these port scanners do not scan higher ports.

To change the default port, you will need to open the configuration file using your favorite text editor (vi,nano) located in
/etc/ssh/sshd_config

and look for a line that says:
Port 22

Change the port number to something like
Port 10000 #use your own

and restart the ssh server by typing
/etc/init.d/ssh restart

*note: you may need to be root in order to change and restart the ssh service.

By changing the default port, you now can connect to the server by typing the following command:
ssh -p username@server

Comments