How to Change Your SSH Port

Changing the default SSH port from 22 to a custom port can help reduce automated login attempts. This article explains how to change it on a Linux server.

Important Note

Changing the SSH port is not a replacement for strong authentication. Always use strong passwords or SSH keys, and consider a firewall.

Changing the Port

  1. Log into your server via SSH.
  2. Open the SSH configuration file:
    sudo nano /etc/ssh/sshd_config
  3. Find the line #Port 22 and change it to your desired port, for example:
    Port 2222
  4. Save the file and exit.
  5. Restart the SSH service:
    sudo systemctl restart sshd
  6. Update your firewall to allow the new port.

Connecting to the New Port

ssh -p 2222 username@your-server-ip

Need Help?

If you get locked out after changing the port, contact us through the Circle City Servers Support Portal.

  • ssh port, security
  • 0 istifadəçi bunu faydalı hesab edir
Bu cavab sizə kömək etdi?

Uyğun məqalələr

How to Reset Your Server Password

If you've forgotten your server password or need to reset it for security reasons, Circle City...

How to Connect via RDP on Windows Servers

Remote Desktop Protocol (RDP) allows you to connect to your Windows server with a graphical...

How to Use SSH Keys for Secure Login

SSH keys provide a more secure way to log into your server than passwords alone. This article...

How to Use SSH Keys for Secure Login

SSH keys provide a more secure way to log into your server than passwords alone. This article...

Troubleshooting Network Connectivity Issues

If you are unable to reach your server, this guide will help you identify and resolve common...