{"id":2064,"date":"2021-06-10T15:40:29","date_gmt":"2021-06-10T12:40:29","guid":{"rendered":"https:\/\/www.scalahosting.com\/kb\/?p=2064"},"modified":"2022-03-15T18:08:20","modified_gmt":"2022-03-15T16:08:20","slug":"how-to-change-the-ssh-server-port-number","status":"publish","type":"post","link":"https:\/\/www.scalahosting.com\/kb\/how-to-change-the-ssh-server-port-number\/","title":{"rendered":"How to Change the SSH Server Port Number"},"content":{"rendered":"<p><span style=\"font-weight: 400;\">The default <\/span><a href=\"https:\/\/www.scalahosting.com\/blog\/what-is-ssh-and-how-to-use-it\/\"><b>SSH port<\/b><\/a><b> for all servers is 22<\/b><span style=\"font-weight: 400;\">. Once you get administrative control over your server, it is recommended that you change the default port for security reasons. Bear in mind, however, that to do it, you will need <strong>root access<\/strong>.<\/span><\/p>\n<p><b> To change the default port:<\/b><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Step 1.<\/b><span style=\"font-weight: 400;\"> Use SSH to connect to your server and log in as root.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Step 2.<\/b><span style=\"font-weight: 400;\"> Open the sshd_config file using a text editor. This file is located in the \u201c\/etc\/ssh\u201d folder.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Step 3.<\/b><span style=\"font-weight: 400;\"> Identify the line specifying \u201cPort 22\u201d and change it to the port number you wish to use.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Step 4.<\/b><span style=\"font-weight: 400;\"> Save changes when exiting the file editor.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Step 5.<\/b><span style=\"font-weight: 400;\"> Restart the SSH service using the following commands<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">For CentOS\/Fedora: \u201c<\/span><b>service sshd restart\u201d<\/b><\/p>\n<p><span style=\"font-weight: 400;\">For Debian\/Ubuntu: <\/span><b>\u201cservice ssh restart\u201d<\/b><\/p>\n<p><b>Note:<\/b><span style=\"font-weight: 400;\"> Do not close your SSH session window before testing if the new setting works. First, test the configuration by opening a new terminal window and attempting to log in with the new port.<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The default SSH port for all servers is 22. Once you get administrative control over your server, it is recommended that you change the default port for security reasons. Bear in mind, however, that to do it, you will need root access. To change the default port: Step 1. Use SSH to connect to your [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_seopress_robots_primary_cat":"","_seopress_titles_title":"","_seopress_titles_desc":"","_seopress_robots_index":"","footnotes":""},"categories":[34],"tags":[],"class_list":["post-2064","post","type-post","status-publish","format-standard","hentry","category-web-hosting"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/posts\/2064","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/comments?post=2064"}],"version-history":[{"count":4,"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/posts\/2064\/revisions"}],"predecessor-version":[{"id":4028,"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/posts\/2064\/revisions\/4028"}],"wp:attachment":[{"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/media?parent=2064"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/categories?post=2064"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/tags?post=2064"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}