How to change default SSH port?

Everyone knows 22 is the default SSH port. So it’s always good to change this default port and set it to something unguessable. Please follow the below steps.

Here we are 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

That’s it!! You have changed the SSH port to 4242. :)

To login as “sshusr” from a remote Linux machine you can run the below command.

ssh [email protected]/Hostname -p 4242

 

Was this answer helpful?

 Print this Article

Also Read

How to Secure WHM/cPanel

Login to WHM using root username/passwdhttp://serverip:2086 or http://serverip/whm WHM –...

How to prevent DDoS attack with csf?

First make sure DDOS attack is not from open recursive DNS settings. To check and fix that issue...

what is eXploit Scanner (cxs)

eXploit Scanner (cxs) is a new tool from Configserver that performs active scanning of files as...

Installing and configuring Spamassassin on CentOS

If you run your own mail server you'll want it to run spam filtering software to reduce the...

Prevent DDoS by using mod_evasive

“mod_evasive” is an evasive maneuvers module for Apache to provide evasive action in...