By default the any Linux SSH server (usually OpenSSH) listens for connections on port 22. This is public knowledge and everyone knows including the bad guys. This is the default port when you install and configure SSH server on your Linux operating system. Among other steps to secure your Linux server that is facing the Internet you should thing to change the default SSH port 22 to something else.
Of course, you should disable permission for root to log in over ssh – this is like rule number #1. You should never log on to your server as the root, rather log on as the user and the switch to root and use the privileges wisely.
How do we change the port:
- To change your SSH port, switch to root, edit the sshd_config file in your /etc/ssh/sshd_config
- Find a line that says Port 22
- Change the number to the port number of your choice. Make sure it is a port not used by another service.
- Save the file and then restart sshd service
Now you should try to connect to you server over SSH with the new port number.