Change SSH Port in Centos – Linux and Webmin
By default SSH runs over port 22, this is well known and because of this it can be used for malicious reasons to try and access a websites core files or your Linux Servers. As part of improving security to a site you should make sure that you change the default port to something else. Here we will change the port in Centos 6.3 ( although this is for all flavors of Linux ) via command line and also change the SSH port via Webmin.
Change The SSH Port Number in Centos
First log in to your VPS or Centos Server and browse to the following path.
Once there you will see a file named SSHD_Config, we need to edit this. I use a file editor name nano, you can use your tool of choice. In my situation I run the following command.
you will see the config file open. Once open you can see the default port of 23, simply edit the value to the port number of your choice, I have used a random number here.
Once done simply save and now when you use your SSH application such as Putty you will need to specify the new port number.
Change the SSH Port in Webmin
Again this is a very simple process, do change the SSH port in Webmin simply browse to the SSH server.
Then select the edit option as seen below. Once done simply edit the config files default port from 23 to the port of choice and save.