Choose language

Portal Home > Knowledgebase > How-to > Dedicated servers > Changing SSH port


Changing SSH port




Assuming you have already logged into the server, run the following command to locate your SSHd config file:

locale sshd_config

 

 

That command will give you the location of your SSHd config file, usually /etc/ssh/sshd_config

 

Now open up that config file using your favorite text editor, we'll use nano.

nano /etc/ssh/sshd_config

 

The bit of information we're interested in looks like this:

port 22

 

Change port number (22) into a different one with 3-4 digits e.g. 4421, then it should look like this:

port 4421

Save the file, exit the editor, and run this command:

/etc/init.d/ssh restart

 

If that command gives you an error, try:

/etc/init.d/sshd restart

 

If you have done everything correctly, SSH should already work on a new port.

 



Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article

Also Read
SSH how to get connected (Views: 13088)
Rescue mode (Views: 10273)

Powered by WHMCompleteSolution