Tech Blog

Changing default SSH port

Tags: , ,

By default, the SSH port is set to 22.
Locate the following line in the file /etc/ssh/sshd_config:
#Port 22

Remove # and change 22 to your desired port number. Though make sure you do not use the ports which are used by other systems ( i.e. 465,993 which are mail ports etc).

Save the changes and close the file. Press Ctrl + O to save. Type Ctrl + X to exit.

To apply the settings, the SSH service needs to be restarted. If you are logged in as a techuser (or your custom created one to replace root), you will need to use the sudo command to perform this action.

sudo systemctl restart sshd