Changing the SSH Port for Your Linux Servers

Considering security measures, it is possible to change the default SSH Port for the Linux server. I this small tutorial we will be explaining how to change the SSH Port for the Linux servers like Debian, Ubuntu and others.

Change SSH Port

WARNING: Make sure the new SSH Port does not conflict with any known or blocked ports like 80, 443.

How to Change the SSH Port in Linux Servers?

Follow the steps one by one…

1. Connect to the server via SSH by root user.

2. Open SSHD_CONFIG for modification by following command.

nano /etc/ssh/sshd_config

3. Locate #Port 22.

4. Remove # and change the 22 with desired one.

5. Save edits and Restart SSHD by following command.

service sshd restart

Now we have successfully changed the SSH Port for our Linux server.

All we need to just login with new port, like – ssh user@ip -p port.