Changing the SSH Port for Your Linux Server  Print this Article

You can change the default SSH port for your Linux server as an added security measure

NOTE! Make sure the new SSH port does not conflict with any known or blocked ports, and it is enable in your firewall !

To Change the SSH Port for Your Linux Server:

Step 1

Connect to your server via SSH

Step 2

Open /etc/ssh/sshd_config with your favorite text editor

Step 3

Locate the following line:
# Port 22

Step 4

Remove # and change 22 to your desired port number and save the file. Please use port numbers higher then 1024
Port 31337

Step 5

Restart your SSH server
service sshd restart
sudo reload ssh

Was this answer helpful?

Related Articles

How Do I Find The Largest Top 10 Files and Directories On a Linux / UNIX / BSD?
ow do I find the largest top files and directories on a Linux or Unix-like operating systems?...
Create passwordless login with SSH keys and PUTTY
Benefits of passwordless login with SSH keys If VPS/Dedicated server is visible over the...
How to install Ansible and Use it in Automation
In this artical we will known about how to install Ansible, Before going through that we would...
IPTABLES examples
#1: Displaying the Status of Your Firewall Type the following command as root: # iptables -L -n...
25 Most Frequently Used Linux IPTables Rules Examples
In the below examples we are using ETH0 as network interface, which would be the interface you...