How to Change the Default SSH Port on Linux

In this tutorial, we will show you how to change the SSH default port in Linux, and go over why changing this default port is a good idea. IMPORTANT: Before we go any further, you should understand that this is not a solution that will prevent or deter a determined hacker to attack your SSH service. It is merely a measure to help you avoid the thousands of automated bots running all the time scanning vast ranges of IP space searching for standard SSH ports being open. Preventing a determined hacker from brute-forcing your SSH service is beyond the scope of this article.

SSH, also known as Secure Shell, is the most widely-used protocol for connecting to and managing Linux systems remotely. SSH offers strong encryption and authentication along with excellent customizability, and using SSH gives you the freedom of accessing a remote machine. You can run services and software as if you were physically using the machine, no matter where you are.

By default, SSH runs on port 22. Since this is common knowledge, this port often becomes a target for brute force attacks. Because this provides full access to your server’s OS, people with malicious intent will often target port 22 more than any other port. Changing the default SSH port will prevent automated attacks that don’t spend the time to rotate ports when targeting a Linux Server. To protect your server from a brute force attack, you should change the default SSH port to something else.

Read More