You are here
Changing default SSH port in CENTOS
I thought this would be useful in helping to secure your CentOS linux box better
So basically, the default SSH port is 22 allowing anyone to be able to get to your username and password prompt and do some bruteforcing etc.
You can move SSH to a different port by editing the /etc/sshd/sshd_config file
I like to use nano (a small text editor to edit text files in CentOS) so basically you type the following at the console prompt
Look for the line
Remove the # from the start of the line
Change the number 22 to some other number. Make sure the number is a positive number and less than 65535. Also make sure its not a port in use. For example port 80 is used for http so you never want to use a port that is currently in use by another server application that is listening for connections.
Save your config file
Then do the following:
service sshd stop
service sshd restart
Now open another ssh client and connect to the new port and make sure it is working before you close off your previous ssh client connection (this is to make sure that you can get back into your linux box)
WARNING: IF YOU DO THIS WRONG, YOU CAN LOSE ALL ACCESS TO YOUR BOX!!! WHICH COULD BE SERIOUSLY HORRIBLE.