• Domains
  • Web Hosting
  • WordPress Hosting
  • Reseller Hosting
  • Cloud VPS
  • Dedicated Servers
  • Domains
  • Web Hosting
  • WordPress Hosting
  • Reseller Hosting
  • Cloud VPS
  • Dedicated Servers
home/Knowledge Base/Dedicated Servers/Basic Security/Changing the Default SSH Port (Linux / Ubuntu / Debian)
Popular Search:Dedicated Server, CentOS, Web Hosting

Changing the Default SSH Port (Linux / Ubuntu / Debian)

47 views 0 November 26, 2019 aklwebhost

SSH is one of the most commonly attacked services as it provides easy access to full control of a dedicated server. Changing the default SSH port will help prevent an attacker from launching brute force attacks to the default port.

1. Login as the server as root (or gain root access by executing ‘sudo su’)

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’

3. Execute ‘nano /etc/ssh/sshd_config’ and look for the line that contains ‘Port 22’

4. Change the number ’22’ to any unused port you’d like

Save and exit by holding down ‘ctrl’ and ‘x’

5. Restart the SSH service by executing ‘restart ssh’ within the command line

For Debian, execute ‘service ssh restart’

6. If you can still access the command line, type ‘ss -tnlp | grep ssh’ to verify SSH is listening on the new port. (optional)

7. Start a new SSH session on the new port.

8. Delete the old firewall rule for the old port by executing ‘ufw delete allow 22/tcp’

Tags:Changing the Default SSH Port (Linux / Ubuntu / Debian)

Was this helpful?

Yes  No
Related Articles
  • Securing SSH on Ubuntu 14.04
  • Setup ConfigServer Security and Firewall (CSF) on CentOS 7
  • Securing SNMP (Linux / Windows)
  • Securing NTP (Linux Only)
  • Enabling and basic configuration of the firewall settings (Linux / Ubuntu)
  • Disabling SSDP (Linux / Windows)
Leave A Comment Cancel reply

Basic Security
  • Changing the Default SSH Port (Linux / Ubuntu / Debian)
  • Securing SSH on Ubuntu 14.04
  • Setup ConfigServer Security and Firewall (CSF) on CentOS 7
  • Securing SNMP (Linux / Windows)
  • Securing NTP (Linux Only)
  • Enabling and basic configuration of the firewall settings (Linux / Ubuntu)
View All 8  
Popular Articles
  • Using StrongSwan for IPSec VPN on CentOS 7
  • Disabling SSDP (Linux / Windows)
  • Can I pay by Western Union?
  • Can a Coupon Code Discount Be Carried Forward While I Upgrade My VPS Account
  • Can I pay multiple due invoices using a single transaction?
KB Categories
  • Billing
  • Cloud Hosting
  • CMS Hosting
  • cPanel/WHM Control Panel Guide
  • Dedicated Servers
    • AMD Opteron 6272
    • Arch
    • Backup Storage
    • Bandwidth
    • Basic Security
    • BSD
    • CentOS
    • Containers
    • CoreOS
    • DDoS Protection
    • Debian
    • Dedicated Server Control Panel
    • Intel Core i5 3550
    • Intel Core i5 4570
    • Intel Core i7 3770
    • Intel Core i7 4770
    • Intel Xeon E3 1230 V3
    • Intel Xeon E3 1245 V2
    • IP Space
    • Linux Guides
    • Minecraft
    • Networking
    • Server Apps
    • Server Troubleshooting
    • Ubuntu
    • Windows Guides
    • Windows Server 2008
    • Windows Server 2012
  • Domain Names
  • Email Support Documentation
    • Setup IMAP or POP
    • User Features – How To
    • Webmail – How To
  • FTP (File Transfer Protocol
    • CuteFTP Guide
    • FileZilla Guide
  • Game Servers
  • MySQL and MariaDB
  • Node.js
  • Plesk Web Hosting Guide
  • VPS Server
  • Web Servers

  Changing the Default SSH Port (Linux / CentOS)

Disable Recursive DNS (Linux / Windows)  

  • Privacy Policy
  • Terms of Use
  • © 2022 AKLWEB HOST LLC, All Rights Reserved.

Popular Search:Dedicated Server, CentOS, Web Hosting