Changing SSH default port 22 to another port in Ubuntu 16.04/14.04 and CentOS 7

Spread the love

Changing SSH default port 22 to another port in Ubuntu and CentOS linux systems

Changing the SSH default port in ubuntu, CentOS Linux Server:

Changing SSH port number is a good idea. because many attackers scan the internet for the port 22. If they get any reply they will try to login to the server with Random Password. So Changing SSH port may help it to reduce the risk. So now in this short tutorial, we will learn  “how to change the SSH port number in Ubuntu or CentOS machines “

open the ssh configuration file.

Then find the parameter port and change it to desired port number.

Then save the file and exit from the editor. Look at the following image for more details.

Changing SSH default port 22 to another port in Ubuntu and CentOS linux systems

Now go ahead restart the SSH service using the following command.

Testing :

We just changed the SSH default from port 22 to port 29999. Now we will try to connect to that port using the SSH from the remote client.

Now enter the password to login into the server.

That’s it, You successfully changed your SSH port number on your Linux Box.

Venkatesh Macha

Hi Guys, I am Venkatesh Macha. I am a programmer, Presently working as a Software Engineer. I love Linux and Open Source. Apart from that, I love to explore new technologies and things.

You may also like...

Leave a Reply