👨‍💻 Change the default SSH port in 🐧 Linux Server

👨‍💻 Change the default SSH port in 🐧 Linux Server

By default on Linux servers SSH runs on 22 port. We can change the default SSH port for Linux server as an added security measure.

NOTE: Before changing the SSH port makes sure the new SSH port does not conflict with any known, used or blocked ports.


To change the SSH port on your Linux server follow the below steps:

1. Connect to server as the root user or switch the user root using the following command:

sudo su

3. Open the sshd_config file in your favorite text editor:

nano /etc/ssh/sshd_config

4. Find the following line

port 22

5. Change 22 to your desired port number. For example:

port 2802

6. Save the changes andrestart ssh services

service sshd restart
whoami
Stefan Pejcic
Join the discussion

I enjoy constructive responses and professional comments to my posts, and invite anyone to comment or link to my site.