ubuntu-10-logoBy default the SSH daemon listens on port 22 for incoming connections, meaning that in order to harden your server installation ever so slightly, you should switch out the default port 22 to something a little more obscure.

To do this is relatively easy. Simply open the the config file and change the Port declaration (which is right near the top of the file):

sudo nano /etc/ssh/sshd_config

After changing the value to something like 2211, save the file and exit.

now reload the service daemon with:

sudo reload ssh

Important, don’t yet log out of your current root SSH session! We first need to test if our change was successful. So launch up a new terminal and log in to your server using the new port number:

ssh -p 2211 myusername@

If you successfully connect, great, you know your change was a success. You can further ease your mind by trying to SSH in via a new terminal using the old port number – this connection attempt should fail.

Now that you know the change has been made, you can log out of your initial root terminal window where you originally made the change.