How to change SSH port on the server?

How to change SSH port on the server

what is SSH?

Before starting to change SSH port on the server, What is ssh? The Secure Shell Protocol is a cryptographic network protocol for operating network services securely over an unsecured network. Typical applications include remote command-line, login, and remote command execution, but any network service can be secured with SSH

Enter the SSH via Putty

We write the following

nano /etc/ssh/sshd_config

The following window will appear

Change SSH Port On The Server-1

We change the original port 22 to your port of four numbers and we will use 8899 as an example in the explanation with the deletion of # to be as follows:-

From the keyboard button, press Ctrl + X, then Y, and then Enter

Then restart the SSH service using the following command:-

systemctl restart sshd.service

Now you can re-enter the new port

How to change the shell port in CSF Firewall

If you have a CSF firewall in the server, you must add the new port number in the incoming and outgoing TCP fields. We enter the WHM panel, then ConfigServer Security & Firewall, choose Firewall Configuration, and search for TCP_IN as shown in the following image:-

Change SSH Port On The Server-3

Add a new SSH port at the end of the line as shown in the image above

Save the changes and restart the CSF firewall to install the settings

Thus, the SSH port on the server has been successfully changed

If you have a problem or inquiry, do not hesitate to contact us via the Contact Us page

You might also like
× Hello...How Can Help You?