Get your server issues fixed by our experts for a price starting at just 25 USD/Hour. Click here to register and open a ticket with us now!

Author Topic: Change default SSH port  (Read 1168 times)

0 Members and 1 Guest are viewing this topic.

nandulalr

  • Guest
Change default SSH port
« on: May 01, 2018, 04:54:02 pm »
The SSH Protocol by default uses port 22. To improve security you need to change the default port. It will stop many automated attacks and a bit harder to guess which port SSH is accessible from

You can easily change the SSH Port on our Linux server. The ssh port defined in the sshd_config file. This file located in /etc/ssh/sshd_config location.

1. Login to your server via SSH as user root
Code: [Select]
ssh root@IP_Address

2. Open the SSH configuration file with your favorite text editor and find the lines that specify the SSH port.
Code: [Select]
vim /etc/ssh/sshd_config
#Port 22

3. Uncomment the relevant line by removing the # sign and change the default port 22 to the one that you want to use.
Code: [Select]
Port xxxx

Save the changes and exit.

4. Before changing the port, you should make sure that the new port is free and it is not used by another service on your VPS. You should also check if the port is not closed in your server firewall.

5. Now, restart the SSH service for the changes to take effect.
Code: [Select]
service sshd restart

6. Verify SSH is listening on the new port by connecting to it. Note how the port number now needs to be declared.
Code: [Select]
ssh root@IP_Address -p xxxx