{"id":56746,"date":"2020-06-19T16:13:18","date_gmt":"2020-06-19T20:13:18","guid":{"rendered":"https:\/\/www.inmotionhosting.com\/support\/?p=56746"},"modified":"2025-07-30T17:06:36","modified_gmt":"2025-07-30T21:06:36","slug":"how-to-change-your-server-ssh-port","status":"publish","type":"post","link":"https:\/\/www.inmotionhosting.com\/support\/product-guides\/cloud-server\/how-to-change-your-server-ssh-port\/","title":{"rendered":"How to Change Your Server SSH Port"},"content":{"rendered":"\n<p>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.<\/p>\n\n\n\n<p>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.<\/p>\n\n\n\n<p class=\"alert alert-info\">You must have root access on a cloud server or managed VPS or dedicated server to complete the steps below.<\/p>\n\n\n\n<p>Port 22 is the default SSH port and it&#8217;s open by default. Changing your server SSH port can protect you from a lot of less sophisticated attacks. If you&#8217;re a cPanel administrator with root WebHost Manager (WHM) access, you should disable SSH access for cPanel accounts that don&#8217;t need it.<\/p>\n\n\n\n<p>Below we cover how to <a href=\"#change\">change your server SSH port<\/a>.<\/p>\n\n\n\n<p class=\"alert alert-danger\">Before continuing, create a server backup or snapshot in your Account Management Panel (AMP).<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"change\">Change Your Server SSH Port<\/h2>\n\n\n\n<p>Before you begin, ensure the new port number you plan to use isn&#8217;t already used by another service on your server. The quickest method is to type <code>yourdomain<\/code><code>.com:9999<\/code>, replacing the number with your preferred new SSH port.<\/p>\n\n\n\n<p class=\"alert alert-warning\">If you get locked out of your server, you may have to flush your firewall rules in AMP to regain access.<\/p>\n\n\n\n<ol class=\"article_list wp-block-list\"><li><a href=\"https:\/\/www.inmotionhosting.com\/support\/server\/ssh\/how-to-login-ssh\/\">SSH into your server<\/a> as root<\/li><li>Open the port in your server firewall (e.g. Firewalld and ConfigServer Security &amp; Firewall)<\/li><li>Edit your SSH configuration file: <br><pre>sudo nano \/etc\/ssh\/sshd_config<\/pre><\/li><li>Edit the line <code>#Port 22<\/code> to your preferred port number and remove the <code>#<\/code>, for example: <br><pre>Port 8398<\/pre><\/li><li>Restart SSHD: <br><pre>systemctl restart sshd.service<\/pre><\/li><li>While your current SSH session is still open, log into the server with a new terminal session using the new port to confirm it works<br><pre>ssh user@example.com -p 9999<\/pre><\/li><\/ol>\n\n\n\n<p>If you have any issues, you may need to ensure the port is open on your local network or workstation.<\/p>\n\n\n\n<p>Learn more from our <a href=\"https:\/\/www.inmotionhosting.com\/support\/product-guides\/cloud-server\/\">Cloud Server Hosting Product Guide<\/a>.<\/p>\n\n\n<div class=\"jumbotron\"><p>With our <a href=\"https:\/\/www.inmotionhosting.com\/cloud-vps\">Cloud Server Hosting<\/a>, you can deploy a lightning-fast, reliable cloud platform with built-in redundancy \u2013 ensuring the availability of your environment!<\/p><\/div>\n","protected":false},"excerpt":{"rendered":"<p>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<a class=\"moretag\" href=\"https:\/\/www.inmotionhosting.com\/support\/product-guides\/cloud-server\/how-to-change-your-server-ssh-port\/\"> Read More ><\/a><\/p>\n","protected":false},"author":57014,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4370],"tags":[],"class_list":["post-56746","post","type-post","status-publish","format-standard","hentry","category-cloud-server"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.1.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to Change Your Server SSH Port | InMotion Hosting<\/title>\n<meta name=\"description\" content=\"Many brute-force attacks are automated and attack common default configurations. Learn how to change your server SSH port to harden Linux server security.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.inmotionhosting.com\/support\/product-guides\/cloud-server\/how-to-change-your-server-ssh-port\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Change Your Server SSH Port | InMotion Hosting\" \/>\n<meta property=\"og:description\" content=\"Many brute-force attacks are automated and attack common default configurations. Learn how to change your server SSH port to harden Linux server security.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.inmotionhosting.com\/support\/product-guides\/cloud-server\/how-to-change-your-server-ssh-port\/\" \/>\n<meta property=\"og:site_name\" content=\"InMotion Hosting Support Center\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/inmotionhosting\/\" \/>\n<meta property=\"article:published_time\" content=\"2020-06-19T20:13:18+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-07-30T21:06:36+00:00\" \/>\n<meta name=\"author\" content=\"InMotion Hosting Contributor\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@https:\/\/twitter.com\/InMotionHosting\" \/>\n<meta name=\"twitter:site\" content=\"@InMotionHosting\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"InMotion Hosting Contributor\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/product-guides\/cloud-server\/how-to-change-your-server-ssh-port\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/product-guides\/cloud-server\/how-to-change-your-server-ssh-port\/\"},\"author\":{\"name\":\"InMotion Hosting Contributor\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/f9a4fc454cd1df128ee8e898d30d4644\"},\"headline\":\"How to Change Your Server SSH Port\",\"datePublished\":\"2020-06-19T20:13:18+00:00\",\"dateModified\":\"2025-07-30T21:06:36+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/product-guides\/cloud-server\/how-to-change-your-server-ssh-port\/\"},\"wordCount\":347,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\"},\"articleSection\":[\"Cloud Server Hosting\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.inmotionhosting.com\/support\/product-guides\/cloud-server\/how-to-change-your-server-ssh-port\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/product-guides\/cloud-server\/how-to-change-your-server-ssh-port\/\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/product-guides\/cloud-server\/how-to-change-your-server-ssh-port\/\",\"name\":\"How to Change Your Server SSH Port | InMotion Hosting\",\"isPartOf\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#website\"},\"datePublished\":\"2020-06-19T20:13:18+00:00\",\"dateModified\":\"2025-07-30T21:06:36+00:00\",\"description\":\"Many brute-force attacks are automated and attack common default configurations. Learn how to change your server SSH port to harden Linux server security.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/product-guides\/cloud-server\/how-to-change-your-server-ssh-port\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.inmotionhosting.com\/support\/product-guides\/cloud-server\/how-to-change-your-server-ssh-port\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/product-guides\/cloud-server\/how-to-change-your-server-ssh-port\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.inmotionhosting.com\/support\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Change Your Server SSH Port\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#website\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/\",\"name\":\"InMotion Hosting Support Center\",\"description\":\"Web Hosting Support &amp; Tutorials\",\"publisher\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.inmotionhosting.com\/support\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\",\"name\":\"InMotion Hosting\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg\",\"contentUrl\":\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg\",\"width\":696,\"height\":696,\"caption\":\"InMotion Hosting\"},\"image\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/inmotionhosting\/\",\"https:\/\/x.com\/InMotionHosting\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/f9a4fc454cd1df128ee8e898d30d4644\",\"name\":\"InMotion Hosting Contributor\",\"description\":\"InMotion Hosting contributors are highly knowledgeable individuals who create relevant content on new trends and troubleshooting techniques to help you achieve your online goals!\",\"sameAs\":[\"https:\/\/www.linkedin.com\/company\/inmotion-hosting\/\",\"https:\/\/x.com\/https:\/\/twitter.com\/InMotionHosting\"],\"url\":\"https:\/\/www.inmotionhosting.com\/support\/author\/inmotion-hosting-contributor\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Change Your Server SSH Port | InMotion Hosting","description":"Many brute-force attacks are automated and attack common default configurations. Learn how to change your server SSH port to harden Linux server security.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.inmotionhosting.com\/support\/product-guides\/cloud-server\/how-to-change-your-server-ssh-port\/","og_locale":"en_US","og_type":"article","og_title":"How to Change Your Server SSH Port | InMotion Hosting","og_description":"Many brute-force attacks are automated and attack common default configurations. Learn how to change your server SSH port to harden Linux server security.","og_url":"https:\/\/www.inmotionhosting.com\/support\/product-guides\/cloud-server\/how-to-change-your-server-ssh-port\/","og_site_name":"InMotion Hosting Support Center","article_publisher":"https:\/\/www.facebook.com\/inmotionhosting\/","article_published_time":"2020-06-19T20:13:18+00:00","article_modified_time":"2025-07-30T21:06:36+00:00","author":"InMotion Hosting Contributor","twitter_card":"summary_large_image","twitter_creator":"@https:\/\/twitter.com\/InMotionHosting","twitter_site":"@InMotionHosting","twitter_misc":{"Written by":"InMotion Hosting Contributor","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.inmotionhosting.com\/support\/product-guides\/cloud-server\/how-to-change-your-server-ssh-port\/#article","isPartOf":{"@id":"https:\/\/www.inmotionhosting.com\/support\/product-guides\/cloud-server\/how-to-change-your-server-ssh-port\/"},"author":{"name":"InMotion Hosting Contributor","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/f9a4fc454cd1df128ee8e898d30d4644"},"headline":"How to Change Your Server SSH Port","datePublished":"2020-06-19T20:13:18+00:00","dateModified":"2025-07-30T21:06:36+00:00","mainEntityOfPage":{"@id":"https:\/\/www.inmotionhosting.com\/support\/product-guides\/cloud-server\/how-to-change-your-server-ssh-port\/"},"wordCount":347,"commentCount":0,"publisher":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#organization"},"articleSection":["Cloud Server Hosting"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.inmotionhosting.com\/support\/product-guides\/cloud-server\/how-to-change-your-server-ssh-port\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.inmotionhosting.com\/support\/product-guides\/cloud-server\/how-to-change-your-server-ssh-port\/","url":"https:\/\/www.inmotionhosting.com\/support\/product-guides\/cloud-server\/how-to-change-your-server-ssh-port\/","name":"How to Change Your Server SSH Port | InMotion Hosting","isPartOf":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#website"},"datePublished":"2020-06-19T20:13:18+00:00","dateModified":"2025-07-30T21:06:36+00:00","description":"Many brute-force attacks are automated and attack common default configurations. Learn how to change your server SSH port to harden Linux server security.","breadcrumb":{"@id":"https:\/\/www.inmotionhosting.com\/support\/product-guides\/cloud-server\/how-to-change-your-server-ssh-port\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.inmotionhosting.com\/support\/product-guides\/cloud-server\/how-to-change-your-server-ssh-port\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.inmotionhosting.com\/support\/product-guides\/cloud-server\/how-to-change-your-server-ssh-port\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.inmotionhosting.com\/support\/"},{"@type":"ListItem","position":2,"name":"How to Change Your Server SSH Port"}]},{"@type":"WebSite","@id":"https:\/\/www.inmotionhosting.com\/support\/#website","url":"https:\/\/www.inmotionhosting.com\/support\/","name":"InMotion Hosting Support Center","description":"Web Hosting Support &amp; Tutorials","publisher":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.inmotionhosting.com\/support\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.inmotionhosting.com\/support\/#organization","name":"InMotion Hosting","url":"https:\/\/www.inmotionhosting.com\/support\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/","url":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg","contentUrl":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg","width":696,"height":696,"caption":"InMotion Hosting"},"image":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/inmotionhosting\/","https:\/\/x.com\/InMotionHosting"]},{"@type":"Person","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/f9a4fc454cd1df128ee8e898d30d4644","name":"InMotion Hosting Contributor","description":"InMotion Hosting contributors are highly knowledgeable individuals who create relevant content on new trends and troubleshooting techniques to help you achieve your online goals!","sameAs":["https:\/\/www.linkedin.com\/company\/inmotion-hosting\/","https:\/\/x.com\/https:\/\/twitter.com\/InMotionHosting"],"url":"https:\/\/www.inmotionhosting.com\/support\/author\/inmotion-hosting-contributor\/"}]}},"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"primary_category":{"id":4370,"name":"Cloud Server Hosting","slug":"cloud-server","link":"https:\/\/www.inmotionhosting.com\/support\/product-guides\/cloud-server\/"},"_links":{"self":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/56746","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/users\/57014"}],"replies":[{"embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/comments?post=56746"}],"version-history":[{"count":11,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/56746\/revisions"}],"predecessor-version":[{"id":130729,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/56746\/revisions\/130729"}],"wp:attachment":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/media?parent=56746"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/categories?post=56746"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/tags?post=56746"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}