Blog

Changing Your Default SSH Port



SSH is a great protocol for managing your linux server remotely. However, with protocol that is open to the Internet, there are some basic steps you should take to secure your SSH. One of the most basic things to do, is change the default SSH port of your server. By default, the SSH port is generally 22. Most scanners on the Internet will attempt to guess passwords for common users while scanning port 22. 

By simply changing your default port, you avoid detection in the first place, and thus increase security.

 

"By default, the SSH port is generally 22. Most scanners on the Internet will attempt to guess passwords for common users while scanning port 22."

 

Change Configuration File

Changing the port is simple. You will need to modify your SSH configuration file. You can use any linux text editor for this, but we will use nano/pico for this task.

nano /etc/ssh/sshd_config

Look for a line that states "Port 22". It may not exist, or it may already exist but be commented out with a # infront of it. You will need to add the following line or uncomment the line and change the port:

Port (your desired port)

If you wanted to change your default port to 62772, then your line should look like:

Port 62772

Save the file (Control-X, then Y for nano) and restart SSH.

 

Restart SSH

Once you have saved the changes in your ssh configuration file, you will need to restart the daemon. You can do this by typing:

service ssh restart


Recent Posts