{"id":8999,"date":"2022-10-19T11:03:20","date_gmt":"2022-10-19T11:03:20","guid":{"rendered":"https:\/\/main.crtlhost.com\/?post_type=ht_kb&#038;p=8999"},"modified":"2022-10-19T11:08:37","modified_gmt":"2022-10-19T11:08:37","slug":"change-ssh-port-centos-debian","status":"publish","type":"ht_kb","link":"https:\/\/main.crtlhost.com\/index.php\/knowledge-base\/change-ssh-port-centos-debian\/","title":{"rendered":"Change SSH Port (CentOS &#038; Debian)"},"content":{"rendered":"\n<div class=\"wp-block-group is-vertical is-layout-flex wp-container-core-group-is-layout-4fc3f8e1 wp-block-group-is-layout-flex\">\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-flow wp-block-group-is-layout-flow\">\n<p class=\"has-small-font-size wp-block-paragraph\" style=\"font-style:normal;font-weight:400\">By default,&nbsp;<strong>port 22<\/strong>&nbsp;is used to establish an SSH connection. This port is automatically configured during the installation of your operating system.&nbsp;<\/p>\n\n\n\n<p class=\"has-small-font-size wp-block-paragraph\" style=\"font-style:normal;font-weight:400\">To reduce the number of brute force attacks, you can configure another port for SSH access.&nbsp;<\/p>\n<\/div><\/div>\n<\/div>\n\n\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-flow wp-block-group-is-layout-flow\">\n<h5 class=\"wp-block-heading\" id=\"please-note\" >Please Note<\/h5>\n\n\n\n<p class=\"wp-block-paragraph\">Before changing the port, make sure that the applications and services installed on the server can be configured without a default port. Otherwise, changing the default port may cause these applications and services to stop working.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n<\/div><\/div>\n\n\n\n<div class=\"wp-block-group is-vertical is-layout-flex wp-container-core-group-is-layout-4fc3f8e1 wp-block-group-is-layout-flex\">\n<p class=\"wp-block-paragraph\"><strong>To change the SSH port:<\/strong><\/p>\n\n\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-flow wp-block-group-is-layout-flow\">\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-8f761849 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:100%\">\n<ul class=\"wp-block-list\"><li>Log on to the server as an\u00a0<strong>administrator<\/strong>.<\/li><li>Open the SSH configuration file\u00a0<strong>sshd_config<\/strong>\u00a0with the text editor\u00a0<strong>vi<\/strong>:<br><strong><em>vi \/etc\/ssh\/sshd_config<\/em><\/strong><\/li><li>Search for the entry\u00a0<strong>Port 22<\/strong>.<\/li><li>Replace\u00a0<strong>port 22<\/strong>\u00a0with a port between\u00a0<strong>1024<\/strong>\u00a0and\u00a0<strong>65536<\/strong>.<\/li><li>Save the file.<\/li><li>Restart the service.<\/li><\/ul>\n<\/div>\n<\/div>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-8f761849 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:100%\">\n<ul class=\"wp-block-list\"><li><strong>Ubuntu<\/strong><br><strong><em>service ssh restart<\/em><br>CentOS 7<\/strong><br><em><strong>systemctl restart sshd<\/strong><\/em><br>To establish an SSH connection after this change, enter the following command:<br><strong><em>ssh root@IP_address_of_the_server -p NewPort<\/em><\/strong><\/li><\/ul>\n<\/div>\n<\/div>\n<\/div><\/div>\n<\/div>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>To use your linux server remotely with CLI, you need to connect with ssh protocol<\/p>\n","protected":false},"author":1,"comment_status":"open","ping_status":"closed","template":"","format":"standard","meta":{"footnotes":""},"ht-kb-category":[9],"ht-kb-tag":[16,15],"class_list":["post-8999","ht_kb","type-ht_kb","status-publish","format-standard","hentry","ht_kb_category-kb-vps","ht_kb_tag-change-ssh-port","ht_kb_tag-ssh"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v18.9 (Yoast SEO v19.3) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Change SSH Port (CentOS &amp; Debian) - CrtlHost - VPS - Dedicated Server - Web Hosting<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/main.crtlhost.com\/index.php\/knowledge-base\/change-ssh-port-centos-debian\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Change SSH Port (CentOS &amp; Debian)\" \/>\n<meta property=\"og:description\" content=\"To use your linux server remotely with CLI, you need to connect with ssh protocol\" \/>\n<meta property=\"og:url\" content=\"https:\/\/main.crtlhost.com\/index.php\/knowledge-base\/change-ssh-port-centos-debian\/\" \/>\n<meta property=\"og:site_name\" content=\"CrtlHost - VPS - Dedicated Server - Web Hosting\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/crtlhostGmbH\" \/>\n<meta property=\"article:modified_time\" content=\"2022-10-19T11:08:37+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/main.crtlhost.com\/wp-content\/uploads\/2022\/10\/logo-web-color.png\" \/>\n\t<meta property=\"og:image:width\" content=\"190\" \/>\n\t<meta property=\"og:image:height\" content=\"58\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https:\/\/main.crtlhost.com\/#organization\",\"name\":\"CrtlHost GmbH inc\",\"url\":\"https:\/\/main.crtlhost.com\/\",\"sameAs\":[\"https:\/\/www.facebook.com\/crtlhostGmbH\"],\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/main.crtlhost.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/main.crtlhost.com\/wp-content\/uploads\/2022\/10\/logo-web-color.png\",\"contentUrl\":\"https:\/\/main.crtlhost.com\/wp-content\/uploads\/2022\/10\/logo-web-color.png\",\"width\":190,\"height\":58,\"caption\":\"CrtlHost GmbH inc\"},\"image\":{\"@id\":\"https:\/\/main.crtlhost.com\/#\/schema\/logo\/image\/\"}},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/main.crtlhost.com\/#website\",\"url\":\"https:\/\/main.crtlhost.com\/\",\"name\":\"CrtlHost - VPS - Dedicated Server - Web Hosting\",\"description\":\"#1 VPS &amp; Dedicated Server Host\",\"publisher\":{\"@id\":\"https:\/\/main.crtlhost.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/main.crtlhost.com\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/main.crtlhost.com\/index.php\/knowledge-base\/change-ssh-port-centos-debian\/\",\"url\":\"https:\/\/main.crtlhost.com\/index.php\/knowledge-base\/change-ssh-port-centos-debian\/\",\"name\":\"Change SSH Port (CentOS & Debian) - CrtlHost - VPS - Dedicated Server - Web Hosting\",\"isPartOf\":{\"@id\":\"https:\/\/main.crtlhost.com\/#website\"},\"datePublished\":\"2022-10-19T11:03:20+00:00\",\"dateModified\":\"2022-10-19T11:08:37+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/main.crtlhost.com\/index.php\/knowledge-base\/change-ssh-port-centos-debian\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/main.crtlhost.com\/index.php\/knowledge-base\/change-ssh-port-centos-debian\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/main.crtlhost.com\/index.php\/knowledge-base\/change-ssh-port-centos-debian\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/main.crtlhost.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Articles\",\"item\":\"https:\/\/main.crtlhost.com\/index.php\/knowledge-base\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Change SSH Port (CentOS &#038; Debian)\"}]}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Change SSH Port (CentOS & Debian) - CrtlHost - VPS - Dedicated Server - Web Hosting","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:\/\/main.crtlhost.com\/index.php\/knowledge-base\/change-ssh-port-centos-debian\/","og_locale":"en_US","og_type":"article","og_title":"Change SSH Port (CentOS & Debian)","og_description":"To use your linux server remotely with CLI, you need to connect with ssh protocol","og_url":"https:\/\/main.crtlhost.com\/index.php\/knowledge-base\/change-ssh-port-centos-debian\/","og_site_name":"CrtlHost - VPS - Dedicated Server - Web Hosting","article_publisher":"https:\/\/www.facebook.com\/crtlhostGmbH","article_modified_time":"2022-10-19T11:08:37+00:00","og_image":[{"width":190,"height":58,"url":"https:\/\/main.crtlhost.com\/wp-content\/uploads\/2022\/10\/logo-web-color.png","type":"image\/png"}],"twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Organization","@id":"https:\/\/main.crtlhost.com\/#organization","name":"CrtlHost GmbH inc","url":"https:\/\/main.crtlhost.com\/","sameAs":["https:\/\/www.facebook.com\/crtlhostGmbH"],"logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/main.crtlhost.com\/#\/schema\/logo\/image\/","url":"https:\/\/main.crtlhost.com\/wp-content\/uploads\/2022\/10\/logo-web-color.png","contentUrl":"https:\/\/main.crtlhost.com\/wp-content\/uploads\/2022\/10\/logo-web-color.png","width":190,"height":58,"caption":"CrtlHost GmbH inc"},"image":{"@id":"https:\/\/main.crtlhost.com\/#\/schema\/logo\/image\/"}},{"@type":"WebSite","@id":"https:\/\/main.crtlhost.com\/#website","url":"https:\/\/main.crtlhost.com\/","name":"CrtlHost - VPS - Dedicated Server - Web Hosting","description":"#1 VPS &amp; Dedicated Server Host","publisher":{"@id":"https:\/\/main.crtlhost.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/main.crtlhost.com\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/main.crtlhost.com\/index.php\/knowledge-base\/change-ssh-port-centos-debian\/","url":"https:\/\/main.crtlhost.com\/index.php\/knowledge-base\/change-ssh-port-centos-debian\/","name":"Change SSH Port (CentOS & Debian) - CrtlHost - VPS - Dedicated Server - Web Hosting","isPartOf":{"@id":"https:\/\/main.crtlhost.com\/#website"},"datePublished":"2022-10-19T11:03:20+00:00","dateModified":"2022-10-19T11:08:37+00:00","breadcrumb":{"@id":"https:\/\/main.crtlhost.com\/index.php\/knowledge-base\/change-ssh-port-centos-debian\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/main.crtlhost.com\/index.php\/knowledge-base\/change-ssh-port-centos-debian\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/main.crtlhost.com\/index.php\/knowledge-base\/change-ssh-port-centos-debian\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/main.crtlhost.com\/"},{"@type":"ListItem","position":2,"name":"Articles","item":"https:\/\/main.crtlhost.com\/index.php\/knowledge-base\/"},{"@type":"ListItem","position":3,"name":"Change SSH Port (CentOS &#038; Debian)"}]}]}},"_links":{"self":[{"href":"https:\/\/main.crtlhost.com\/index.php\/wp-json\/wp\/v2\/ht-kb\/8999","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/main.crtlhost.com\/index.php\/wp-json\/wp\/v2\/ht-kb"}],"about":[{"href":"https:\/\/main.crtlhost.com\/index.php\/wp-json\/wp\/v2\/types\/ht_kb"}],"author":[{"embeddable":true,"href":"https:\/\/main.crtlhost.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/main.crtlhost.com\/index.php\/wp-json\/wp\/v2\/comments?post=8999"}],"version-history":[{"count":2,"href":"https:\/\/main.crtlhost.com\/index.php\/wp-json\/wp\/v2\/ht-kb\/8999\/revisions"}],"predecessor-version":[{"id":9002,"href":"https:\/\/main.crtlhost.com\/index.php\/wp-json\/wp\/v2\/ht-kb\/8999\/revisions\/9002"}],"wp:attachment":[{"href":"https:\/\/main.crtlhost.com\/index.php\/wp-json\/wp\/v2\/media?parent=8999"}],"wp:term":[{"taxonomy":"ht_kb_category","embeddable":true,"href":"https:\/\/main.crtlhost.com\/index.php\/wp-json\/wp\/v2\/ht-kb-category?post=8999"},{"taxonomy":"ht_kb_tag","embeddable":true,"href":"https:\/\/main.crtlhost.com\/index.php\/wp-json\/wp\/v2\/ht-kb-tag?post=8999"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}