{"id":1123,"date":"2021-07-20T07:04:29","date_gmt":"2021-07-20T12:04:29","guid":{"rendered":"https:\/\/www.knownhost.com\/kb\/?p=1123"},"modified":"2022-04-20T07:14:30","modified_gmt":"2022-04-20T12:14:30","slug":"how-can-i-change-my-ssh-port","status":"publish","type":"post","link":"https:\/\/www.knownhost.com\/kb\/how-can-i-change-my-ssh-port\/","title":{"rendered":"How can I change my SSH port?"},"content":{"rendered":"\n<p>The default SSH port on all Operating Systems is port 22. For security measures, KnownHost&#8217;s servers are configured to use port 2200.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Changing your SSH port<\/h2>\n\n\n\n<p>The server&#8217;s SSH configuration file is located here:&nbsp;<code>\/etc\/ssh\/sshd_config<\/code><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>SSH into your server as the root user.<ul><li><code>ssh root@&lt;ip address&gt; -p 2200<\/code><\/li><\/ul><\/li><li>Open the configuration file with your favorite text editor. (nano -c in this example. The -c flag shows the line number.)<ul><li><code>nano -c \/etc\/ssh\/sshd_config<\/code><\/li><\/ul><\/li><li>Line #13 shows the current configured port number. (ie. Port 2200) Meaning, SSH is currently using 2200.<\/li><li>Change the numerical digits from 2200 to your desired port number, for this example we will be using 2222.<\/li><li>After changing to your desire port, Press [CTRL] + X to save the changes. You&#8217;ll be prompted, &#8220;Save modified buffer (ANSWERING &#8220;No&#8221; WILL DESTROY CHANGES) ?&#8221; Press Y and then [Enter].<\/li><li>You&#8217;ll again be prompted, &#8220;File Name to Write: \/etc\/ssh\/sshd_config&#8221; , simply press [Enter] at this time.<\/li><li>Restart the SSH daemon:<ul><li><code>\/etc\/init.d\/sshd restart<\/code><\/li><li><code>You should see that it was stopped and started successfully:<\/code><\/li><\/ul><\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>  Stopping sshd:              &#91;  OK  ]\n  Starting sshd:              &#91;  OK  ]<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\"><li>For good measure, let&#8217;s confirm the changes were made and it&#8217;s running properly.<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>  # netstat -tulpn |grep sshd\n  tcp     0     0  0.0.0.0:2222     0.0.0.0:*   LISTEN   5672\/sshd \n  tcp     0     0       :::2222          :::*   LISTEN   5672\/sshd<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\"><li>:2222 shows that it&#8217;s listening properly on 2222 now, rather than 2200.<\/li><\/ul>\n\n\n\n<p>Now when connecting to your server use the newly configured port number.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The default SSH port on all Operating Systems is port 22. For security measures, KnownHost&#8217;s servers are configured to use port 2200. Changing your SSH port The server&#8217;s SSH configuration file is located here:&nbsp;\/etc\/ssh\/sshd_config SSH into your server as the root user.ssh root@&lt;ip address&gt; -p 2200Open the configuration file with your favorite text editor. (nano [&hellip;]<\/p>\n","protected":false},"author":6,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[92],"tags":[123,159,160],"class_list":["post-1123","post","type-post","status-publish","format-standard","hentry","category-technical-support","tag-linux","tag-ssh","tag-ssh-ports"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.6 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How can I change my SSH port? - KnownHost<\/title>\n<meta name=\"description\" content=\"Are you looking for a way to change default SSH port on your KnownHost server? In this guide we will walk you through on how to accomplish this.\" \/>\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.knownhost.com\/kb\/how-can-i-change-my-ssh-port\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How can I change my SSH port? - KnownHost\" \/>\n<meta property=\"og:description\" content=\"Are you looking for a way to change default SSH port on your KnownHost server? In this guide we will walk you through on how to accomplish this.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.knownhost.com\/kb\/how-can-i-change-my-ssh-port\/\" \/>\n<meta property=\"og:site_name\" content=\"KnownHost\" \/>\n<meta property=\"article:published_time\" content=\"2021-07-20T12:04:29+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-04-20T12:14:30+00:00\" \/>\n<meta name=\"author\" content=\"Somesh Z\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Somesh Z\" \/>\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.knownhost.com\\\/kb\\\/how-can-i-change-my-ssh-port\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.knownhost.com\\\/kb\\\/how-can-i-change-my-ssh-port\\\/\"},\"author\":{\"name\":\"Somesh Z\",\"@id\":\"https:\\\/\\\/www.knownhost.com\\\/kb\\\/#\\\/schema\\\/person\\\/8b518f13cf69dd00d147e577d63ff3b1\"},\"headline\":\"How can I change my SSH port?\",\"datePublished\":\"2021-07-20T12:04:29+00:00\",\"dateModified\":\"2022-04-20T12:14:30+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.knownhost.com\\\/kb\\\/how-can-i-change-my-ssh-port\\\/\"},\"wordCount\":185,\"keywords\":[\"linux\",\"ssh\",\"ssh ports\"],\"articleSection\":[\"Technical Support\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.knownhost.com\\\/kb\\\/how-can-i-change-my-ssh-port\\\/\",\"url\":\"https:\\\/\\\/www.knownhost.com\\\/kb\\\/how-can-i-change-my-ssh-port\\\/\",\"name\":\"How can I change my SSH port? - KnownHost\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.knownhost.com\\\/kb\\\/#website\"},\"datePublished\":\"2021-07-20T12:04:29+00:00\",\"dateModified\":\"2022-04-20T12:14:30+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.knownhost.com\\\/kb\\\/#\\\/schema\\\/person\\\/8b518f13cf69dd00d147e577d63ff3b1\"},\"description\":\"Are you looking for a way to change default SSH port on your KnownHost server? In this guide we will walk you through on how to accomplish this.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.knownhost.com\\\/kb\\\/how-can-i-change-my-ssh-port\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.knownhost.com\\\/kb\\\/how-can-i-change-my-ssh-port\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.knownhost.com\\\/kb\\\/how-can-i-change-my-ssh-port\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.knownhost.com\\\/kb\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How can I change my SSH port?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.knownhost.com\\\/kb\\\/#website\",\"url\":\"https:\\\/\\\/www.knownhost.com\\\/kb\\\/\",\"name\":\"KnownHost\",\"description\":\"KnownHost provides a comprehensive webhosting knowledge base to help answer many of your common webhosting and linux questions.\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.knownhost.com\\\/kb\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.knownhost.com\\\/kb\\\/#\\\/schema\\\/person\\\/8b518f13cf69dd00d147e577d63ff3b1\",\"name\":\"Somesh Z\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/276c97317c2d6905cc5a1bd9ceb10a0fd121cc4da22126f648fa88f95dcf32dd?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/276c97317c2d6905cc5a1bd9ceb10a0fd121cc4da22126f648fa88f95dcf32dd?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/276c97317c2d6905cc5a1bd9ceb10a0fd121cc4da22126f648fa88f95dcf32dd?s=96&d=mm&r=g\",\"caption\":\"Somesh Z\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How can I change my SSH port? - KnownHost","description":"Are you looking for a way to change default SSH port on your KnownHost server? In this guide we will walk you through on how to accomplish this.","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.knownhost.com\/kb\/how-can-i-change-my-ssh-port\/","og_locale":"en_US","og_type":"article","og_title":"How can I change my SSH port? - KnownHost","og_description":"Are you looking for a way to change default SSH port on your KnownHost server? In this guide we will walk you through on how to accomplish this.","og_url":"https:\/\/www.knownhost.com\/kb\/how-can-i-change-my-ssh-port\/","og_site_name":"KnownHost","article_published_time":"2021-07-20T12:04:29+00:00","article_modified_time":"2022-04-20T12:14:30+00:00","author":"Somesh Z","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Somesh Z","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.knownhost.com\/kb\/how-can-i-change-my-ssh-port\/#article","isPartOf":{"@id":"https:\/\/www.knownhost.com\/kb\/how-can-i-change-my-ssh-port\/"},"author":{"name":"Somesh Z","@id":"https:\/\/www.knownhost.com\/kb\/#\/schema\/person\/8b518f13cf69dd00d147e577d63ff3b1"},"headline":"How can I change my SSH port?","datePublished":"2021-07-20T12:04:29+00:00","dateModified":"2022-04-20T12:14:30+00:00","mainEntityOfPage":{"@id":"https:\/\/www.knownhost.com\/kb\/how-can-i-change-my-ssh-port\/"},"wordCount":185,"keywords":["linux","ssh","ssh ports"],"articleSection":["Technical Support"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.knownhost.com\/kb\/how-can-i-change-my-ssh-port\/","url":"https:\/\/www.knownhost.com\/kb\/how-can-i-change-my-ssh-port\/","name":"How can I change my SSH port? - KnownHost","isPartOf":{"@id":"https:\/\/www.knownhost.com\/kb\/#website"},"datePublished":"2021-07-20T12:04:29+00:00","dateModified":"2022-04-20T12:14:30+00:00","author":{"@id":"https:\/\/www.knownhost.com\/kb\/#\/schema\/person\/8b518f13cf69dd00d147e577d63ff3b1"},"description":"Are you looking for a way to change default SSH port on your KnownHost server? In this guide we will walk you through on how to accomplish this.","breadcrumb":{"@id":"https:\/\/www.knownhost.com\/kb\/how-can-i-change-my-ssh-port\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.knownhost.com\/kb\/how-can-i-change-my-ssh-port\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.knownhost.com\/kb\/how-can-i-change-my-ssh-port\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.knownhost.com\/kb\/"},{"@type":"ListItem","position":2,"name":"How can I change my SSH port?"}]},{"@type":"WebSite","@id":"https:\/\/www.knownhost.com\/kb\/#website","url":"https:\/\/www.knownhost.com\/kb\/","name":"KnownHost","description":"KnownHost provides a comprehensive webhosting knowledge base to help answer many of your common webhosting and linux questions.","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.knownhost.com\/kb\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.knownhost.com\/kb\/#\/schema\/person\/8b518f13cf69dd00d147e577d63ff3b1","name":"Somesh Z","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/276c97317c2d6905cc5a1bd9ceb10a0fd121cc4da22126f648fa88f95dcf32dd?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/276c97317c2d6905cc5a1bd9ceb10a0fd121cc4da22126f648fa88f95dcf32dd?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/276c97317c2d6905cc5a1bd9ceb10a0fd121cc4da22126f648fa88f95dcf32dd?s=96&d=mm&r=g","caption":"Somesh Z"}}]}},"_links":{"self":[{"href":"https:\/\/www.knownhost.com\/kb\/wp-json\/wp\/v2\/posts\/1123","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.knownhost.com\/kb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.knownhost.com\/kb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.knownhost.com\/kb\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/www.knownhost.com\/kb\/wp-json\/wp\/v2\/comments?post=1123"}],"version-history":[{"count":0,"href":"https:\/\/www.knownhost.com\/kb\/wp-json\/wp\/v2\/posts\/1123\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.knownhost.com\/kb\/wp-json\/wp\/v2\/media?parent=1123"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.knownhost.com\/kb\/wp-json\/wp\/v2\/categories?post=1123"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.knownhost.com\/kb\/wp-json\/wp\/v2\/tags?post=1123"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}