How to Change the Default SSH Port?

Change default SSH Port
This article will help you to change the default SSH Port. It’s always good to change the default SSH port which will save your system from usual hack attempts.

Everyone knows 22 is the default SSH port. It’s always good to change the default SSH port and set it to something someone can’t even guess, which will save your system from usual hack attempts.

Here I’m going to change the port to 4242. Edit the main SSH configuration file.

vi /etc/ssh/sshd_config

 

You can find the below line.

#Port 22

 

Change it as below.

Port 4242

 

Restart SSH to update the changes.

/etc/init.d/sshd restart

 

You have changed the SSH port to 4242.
To login as “sshusr” from a remote Linux machine, you can run the below command.

ssh sshusr@IP/Hostname -p 4242

 

So that’s how you change the default SSH port.

Share this post

Services to Explore

Stay up to date!

Stay up to date with the Web Hosting, Cloud and Server Management Industry News and Tutorials!

We will send you only the relevant emails, and we respect your privacy. Please review our privacy policy for more info.

Linux Management Services

Focus on your business, and let us take care of your Linux Servers!
From what you are reading, it seems you are interested in Linux and related technologies. If you have a moment to spare, please take a look at our Linux Management Services plan, which might interest you even more!
Linux Management Plan

Value-Added Services

We have services that can help you run a successful business. With us, you don't have to worry about these areas because our experts will take care of it for you.

ServerHealers uses cookies.