How to Change Your Server SSH Port Updated on July 30, 2025 by InMotion Hosting Contributor 1 Minutes, 45 Seconds to Read Have you ever tried any basic port scanning with Netcat, Nmap, and Telnet against your server or local network? If so, you know how easy it can be to check for open ports and accompanying services. And anyone can search how to find port numbers in cPanel software. Social engineering is being used more for more sophisticated cyber attacks that bypass cybersecurity measures. But many cyber attacks are still automated scripts that primarily target attack systems with common misconfigurations and default, insecure settings. You must have root access on a cloud server or managed VPS or dedicated server to complete the steps below. Port 22 is the default SSH port and it’s open by default. Changing your server SSH port can protect you from a lot of less sophisticated attacks. If you’re a cPanel administrator with root WebHost Manager (WHM) access, you should disable SSH access for cPanel accounts that don’t need it. Below we cover how to change your server SSH port. Before continuing, create a server backup or snapshot in your Account Management Panel (AMP). Change Your Server SSH Port Before you begin, ensure the new port number you plan to use isn’t already used by another service on your server. The quickest method is to type yourdomain.com:9999, replacing the number with your preferred new SSH port. If you get locked out of your server, you may have to flush your firewall rules in AMP to regain access. SSH into your server as rootOpen the port in your server firewall (e.g. Firewalld and ConfigServer Security & Firewall)Edit your SSH configuration file: sudo nano /etc/ssh/sshd_configEdit the line #Port 22 to your preferred port number and remove the #, for example: Port 8398Restart SSHD: systemctl restart sshd.serviceWhile your current SSH session is still open, log into the server with a new terminal session using the new port to confirm it worksssh [email protected] -p 9999 If you have any issues, you may need to ensure the port is open on your local network or workstation. Learn more from our Cloud Server Hosting Product Guide. With our Cloud Server Hosting, you can deploy a lightning-fast, reliable cloud platform with built-in redundancy – ensuring the availability of your environment! Share this Article InMotion Hosting Contributor Content Writer InMotion Hosting contributors are highly knowledgeable individuals who create relevant content on new trends and troubleshooting techniques to help you achieve your online goals! More Articles by InMotion Hosting Related Articles How to Change Your Server SSH Port cPanel vs Other Web Hosting Control Panels How To Manage SSH Keys for Your Server Install Webmin on Ubuntu 20.04 How to Re-OS Your Cloud Server in AMP Choosing Vesta Control Panel How to Log into Webmin and Update Passwords Adding a User and Domain to Vesta Control Panel How to Add a BIMI Record on Cloud Server Hosting How to Install PHP on a Linux Cloud Server