How to Change an Open SSH Port

How to Change an Open SSH Port thumbnail
OpenSSH can add powerful encryption to all network traffic.

OpenSSH is a free implementation of the SSH (Secure Shell) protocol and associated tools. OpenSSH provides tools to securely log into and to transfer files between your client machine and the connected server. Typically this tool is associated with Linux platforms, and the tools provided by OpenSSH are meant to be a secure replacement of tools such as telnet and ftp. OpenSSH provides a complete encryption channel which even encrypts passwords as they are sent between machines. Other tools do not provide this, which is why OpenSSH is such a compelling option for many administrators. It is possible to add further security to OpenSSH by changing the default IP port used by the SSH daemon to a "random" port of your choosing.

Things You'll Need

  • Linux installation on computer
  • OpenSSH installed
Show More

Instructions

    • 1

      Make a copy of your existing sshd_config file. Change directory to /etc/ssh and copy the sshd_config file to another filename. You may need to do this operation as the superuser (root).

    • 2

      Open the /etc/ssh/sshd_config file in a text editor and change the line Port 22 to Port <your new port number>. Ensure there is no '#' character in the "Port" line. This character will cause the line to be ignored and your change will not take effect. Save the file after editing.

    • 3

      Restart the SSH service, such as sudo /etc/init.d/ssh restart.

    • 4

      Test the new port by connecting from your client machine over the new port number.

Tips & Warnings

  • If you are a non-Linux user, there are implementations of the SSH server daemon for other operating systems as well as implementations of the client tools. One online resource to start from is http://www.openssh.com.

  • To perform many of the steps in this guide, you will likely have to operate as superuser (root). This is because you are modifying a system configuration file and you are restarting a service on the machine. Linux protects these operation from general users.

Related Searches:

References

Resources

  • Photo Credit Martin Poole/Stockbyte/Getty Images

Comments

You May Also Like

Related Ads

Featured