Change SSH Port in Ubuntu 22.04 and CentOS 7
Change the SSH port ( default Port ) in ubuntu, CentOS Linux Server:
Changing the SSH port number is a good idea. because many attackers scan the internet for port 22. If they get any reply they will try to log in to the server with Random Password. So Changing the SSH port may help 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.
# What ports, IPs and protocols we listen for
Then save the file and exit from the editor. Look at the following image for more details.
Now go ahead and restart the SSH service using the following command.
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.
$ ssh email@example.com -p29999
firstname.lastname@example.org 's password:
Now enter the password to login into the server.
That’s it, You successfully changed your SSH port number on your Linux Box.