Changing the SSH Port for Your Linux Server

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
or
sudo reload ssh
Was this answer helpful? 255 Users Found This Useful (487 Votes)