If you install CSF (ConfigServer Security & Firewall) you will find in their recommended list that you need to change your SSH port for security reasons. And changing the SSH port in both Ubuntu or CentOS is not hard.
To change the SSH port in Linux (Ubuntu or CentOS):
1. Open your terminal with root access.
2. Edit the ssh_config file:
vim /etc/ssh/ssh_config
3. Change the port:
Port 22 #Default SSH Port
#change to
Port 2222
4. Save and close. Then restart your SSH server:
/etc/init.d/ssh restart
It’s easy, right? Now when you connect to SSH from PuTTY, for example, you need to use port 2222 instead of blank or 22. Or if you connect from a Linux terminal you need to explicitly specify port 2222:
ssh [email protected] -p 2222
