How to Change the SSH port.html

We will discuss what SSH is and how to modify the SSH port in this article.

What is SSH?

SSH (Secure Shell Protocol) is a cryptographic network protocol for safely operating network services across an unsecured network. 1st Remote command-line, login, and command execution are common applications, although SSH can be used to protect any network service.

Follow the Procedure

  1. Allow traffic to the new SSH port via any firewalls that may be blocking traffic to the server.

2. Use the current SSH port to connect to the server (default 22). It’s important to keep this SSH connection open until you’ve confirmed that you can use 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. SSHD should be started again.


5. SSH should be tested when the new port is specified. Below is an example of how to specify port 1234 with SSH on Linux. This depends on the SSH client you’re using.

ssh USER@HOSTNAME -p1234

6. If the SSH test on the new port passes, you can close the connection that was used to change the port and make any additional changes you want, such as closing the old SSH port. If it fails, you’ll have to debug using the currently active SSH connection. This SSH connection should not be ended until the new port’s SSH test has passed.

We hope that you now have a good understanding of Changing the SSH port.html. If you continue to have problems with the protocol outlined above, please contact the Team for constructive assistance 24×7.