Changing your SSH port

If you want to change your SSH port to something a little less obvious, it’s easy to do. It’s debatable how much security it actually gives you, but it will certainly make you feel safer, and that is probably the most important thing.

pico /etc/ssh/sshd_config

I’m using pico in this example, but vim will work just as well. You should find a line which is commented out, specifying that the port is 22. This doesn’t need to be uncommented normally, as it defaults to port 22.

#Port 22

Just uncomment this and put a new port number in.

Port 8473

Now save the file and exit. Finally, restart SSH for it to take affect.

/etc/rc.d/init.d/sshd restart

Don’t forget, next time you SSH in you will need to use the new port number!

ssh -p 8473 hostname