How To Change SSH Port

This article covers changing the SSH port.

a) ConfigServer Security & Firewall

Change Your SSH Port In Web Host Manager
By default, SSH listens on port 22. This is the first thing a potential attacker is going to try.

I recommend changing this to a random four-digit number such as 5622.

To do this, you have to first open the port in the CSF firewall:

Login to Web Host Manager
Click on Configure Firewall and Security
Click on Firewall Configuration Enter 5622 in the TCP_IN field
Click on Change at the bottom Restart CSF Once the port has been opened in the firewall, you then need to SSH into the server and modify the SSH configuration file.

b) SSH 1) Configure any firewalls that may restrict traffic to the server to allow traffic to the new SSH port.

2) Log in to the server using the current SSH port (default 22). Note that you should not close this SSH connection until you have verified that you can access SSH on the new port number.

3) Set the Port line in /etc/ssh/sshd_config. If the line does not exist it can be added, and if it is commented out, it can be uncommented or added. Commented lines will start with a # character, which can be removed to uncomment them. The Port line will look like this, where 1234 is replaced with the port number you'd like to use. Port 1234

4) Restart SSHD. /scripts/restartsrv_sshd

5) Test SSH while specifying the new port. An example of how to specify port 1234 in SSH on Linux is shown below. This will vary based on the SSH client used. ssh USER@HOSTNAME -p1234

6) If the SSH test on the new port is successful you can close the connection used to change the port and proceed with any other changes you may wish to make, such as closing the previous SSH port. If it is not successful, you will need to troubleshoot using the current working SSH connection. This SSH connection should not be closed until the SSH test on the new port is successful.

  • How To Change SSH Port
  • 0 Utilisateurs l'ont trouvée utile
Cette réponse était-elle pertinente?

Articles connexes

33 Ways to monetize your website Kenya

Making money from your website isn™t a myth. It™s doable by everyone. In fact, turning a...

Commonly Used Port Numbers Kenya

This is a list of commonly used ports, and does not include all possible ports that may be opened...

Here™s Why You Should Start Using CloudFlare Today Kenya

We learned so much at today™s DreamUp with CloudFlare! Brent Coco, a trainer at CloudFlare,...

Heroku Custom Domain Name Kenya

To add a custom domain for heroku app, please follow the procedure below step 1: Point your...

How Clear DNS History/ Cache Kenya

To clear your DNS history/cache, please follow the procedure below Click Start > Control...

Powered by WHMCompleteSolution