• Services
    • Web Hosting
    • Reseller Hosting
    • VPS Hosting
    • Dedicated Hosting
  • Domains
  • Features
  • Company
    • About Us
    • Server Locations
    • Affiliates
    • Company Blog
  • Support
  • Client Login
  • Services
    • Web Hosting
    • Reseller Hosting
    • VPS Hosting
    • Dedicated Hosting
  • Domains
  • Features
  • Company
    • About Us
    • Server Locations
    • Affiliates
    • Company Blog
  • Support
  • Client Login
Home/Article/Linux/How to Change the Default SSH Port (Linux / Ubuntu / Debian)

How to Change the Default SSH Port (Linux / Ubuntu / Debian)

Written by VernalWeb
April 5, 2018

SSH is the best service to control dedicated servers as it provides the full control to perform any task. So it’s one of the commonly used way to attack a server. Changing the default SSH port can help secure your server from launching brute force attacks to the default port.

Step 1: Login as the server as root (or gain root access by executing ‘sudo su‘)
Step 2: Check to see the status of the firewall by executing ‘ufw status‘
If the firewall is active then  we need to add a rule to allow connections for our new SSH port.
This can be done by executing ‘ufw allow newportnumberhere/tcp‘
Step 3: Execute ‘nano /etc/ssh/sshd_config‘ and look for the line that contains ‘Port 22‘
Step 4: Change the number ‘22‘ to any unused port you’d like
    Save and exit by holding down ‘ctrl‘ and ‘x‘
Step 5: Restart the SSH service by executing ‘restart ssh‘ within the command line
    For Debian, execute ‘service ssh restart‘
Step 6: If you can still access the command line, type ‘ss -tnlp | grep ssh‘ to verify SSH is listening on the new port. (optional)
Step 7: Start a new SSH session on the new port.
Step 8: Delete the old firewall rule for the old port by executing ‘ufw delete allow 22/tcp‘

We hope this tutorial helps you find the perfect solution. If your like our tutorials, definitely you’ll love our support. All VernalWeb hosting plans include 24/7 support from our amazing inhouse support staff. Check out our web hosting plans and have your website migrated today!

Tags:SSHSSH Port

Was this helpful?

Yes  No
Related Articles
  • How do I order Extra IPs For My VPS/Dedicated?
  • How to Use KVM with the Intel Core i5 4570
  • How to Change the Default SSH Port (Linux / CentOS)
  • Automating FTP Backups in Linux
  • How to whitelist an IP Address in ConfigServer Firewall (CSF)
  • Troubleshooting/Reporting Network and Packet Loss Issues

Didn't find your answer? Submit Ticket

Latest Articles

  • How to show Hidden Files (.htaccess) in cPanel File Manager
  • Setup a Domain Redirection in cPanel
  • Create a MySQL Database and a User from cPanel
  • Remove page extensions using .htaccess
  • Cron Job Usage & Policy
  • © 2014 - 2025 VernalWeb. All rights reserved.