May 30

By default, all newly set up servers listen and accept SSH login on port 22 which is known universally. To make it a little harder for hackers to break into your user account, one of the first steps you want to take is to change the default SSH port to a different on that’s randomly chosen by you.

To do this, simply modify the sshd configuration file by:

nano /etc/sshd/sshd_config

For novice SSH users, nano is more intuitive than vi. After loading the file in the editor, find and change this line:

Port 22

To

Port 8433

Ctrl + o and ctrl + x should save the change and get you out of the editor.

The port number can be anything between 1024 and 65535, inclusive. You can make it instantly in effect by reloading the new configurations:

/etc/init.d/ssh reload

Now the server will only accept SSH accesses on the port 8433. After modifying this, make sure you also change the remote port setting in your local SSH client or it will be rejected by the hosting server.

2 Responses to “Customize or change the default SSH port 22 to a random custom one of your choice”

  1. Typical iptables Firewall Rules for a Server that Hosts Websites Says:

    [...] Change the default SSH port 22 to a random one of your choice May [...]

  2. Unmanaged Hosting Server Installation & Initial Configuration for Dummies Says:

    [...] Customize the default SSH listening port of 22 to a custom one. [...]

Leave a Reply