Thorn Tech Marketing Ad
Skip to main content
Version: 1.2.0

Changing the Default SSH Port

TLDR

Purpose: Change the OpenSSH service port from the default port 22 to a custom port.

Steps:

  1. SSH into VM and run sudo su
  2. Edit /etc/ssh/sshd_config
  3. Change Port 22 to your desired port (e.g., Port 2222)
  4. Restart SSH: service sshd restart
  5. Update firewall rules to allow the new port

Important: Ensure your firewall/security group allows the new port before disconnecting

Product: StorageLink by Thorn Technologies — cloud storage gateway for secure file sharing

Overview​

The OpenSSH service for StorageLink is located on port 22 by default. However, some users may wish to move the OpenSSH service to that of a different port, which we will show how to do in this article.

Changing the SSH Port​

First, SSH into your VM and elevate your privileges:

sudo su

Then, edit this file:

/etc/ssh/sshd_config

To change the ssh port you would modify this line:

Port 22

To a non-standard port such as port 2222 for example:

Port 2222

To apply your changes you would restart OpenSSH after modifying the config:

service sshd restart

Also, make sure the port you change to is allowed access in your firewall rules.