{"id":3815,"date":"2019-07-10T07:05:55","date_gmt":"2019-07-10T07:05:55","guid":{"rendered":"https:\/\/www.esds.co.in\/kb\/?p=3815"},"modified":"2019-07-10T07:11:39","modified_gmt":"2019-07-10T07:11:39","slug":"how-do-i-change-ssh-port-in-red-hat-enterprise-linux","status":"publish","type":"post","link":"https:\/\/www.esds.co.in\/kb\/how-do-i-change-ssh-port-in-red-hat-enterprise-linux\/","title":{"rendered":"How do I Change SSH Port in Red Hat Enterprise Linux?"},"content":{"rendered":"<p style=\"text-align: justify;\">Port number 22 is the default port used by a Linux SSH Server. Changing the port of SSH aids in avoiding automated attacks by offering security to your server.<\/p>\n<p style=\"text-align: justify;\">Security Enhanced Linux or SELinux is a default feature equipped with Red Hat Enterprise Linux. It is responsible to block each port offering access to SSH; port 22 is offered this capability by default.<\/p>\n<p>If you wish to change your SSH port in SELinux, follow the below given steps.<\/p>\n<p>1.Login as Root<\/p>\n<p>2.To check the current settings of the port run semanage. Enter the command:<br \/>\n<strong>semanage port -l | grep ssh<\/strong><\/p>\n<p>The result displayed will be similar to the one given below:<br \/>\n<strong>ssh_port_t tcp 22<\/strong><\/p>\n<p>3.You can proceed with adding the desired port. Use the command:<br \/>\n<strong>semanage port -a -t ssh_port_t -p tcp 1234<\/strong><\/p>\n<p>Note: Replace 1234 with the port number you wish to add<\/p>\n<p>4.Run the below mentioned command to ensure that the port has been added to acceptable port list:<br \/>\n<strong>semanage port -l | grep ssh<\/strong><\/p>\n<p>Post executing the command, you will find that the port has been added:<br \/>\n<strong>ssh_port_t tcp 1234,22<\/strong><\/p>\n<p>5.Use the below given command to restart SSH for changes to apply:<br \/>\n<strong>\/sbin\/service sshd restart<\/strong><\/p>\n<p>Now, you can access SSH via. your desired port. You need to ensure SSH is configured and port is enabled in the firewall as well.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Port number 22 is the default port used by a Linux SSH Server. Changing the port of SSH aids in avoiding automated attacks by offering security to your server. Security Enhanced Linux or SELinux is a default feature equipped with Red Hat Enterprise Linux. It is responsible to block each port offering access to SSH;&#8230; <\/p>\n<div class=\"clear\"><\/div>\n<p><a href=\"https:\/\/www.esds.co.in\/kb\/how-do-i-change-ssh-port-in-red-hat-enterprise-linux\/\" class=\"gdlr-button small excerpt-read-more\">Read More<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[947],"tags":[505,949,201,192,503,948,504],"aioseo_notices":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v15.9.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How do I Change SSH Port in Red Hat Enterprise Linux?<\/title>\n<meta name=\"description\" content=\"Port number 22 is the default port used by a Linux SSH Server. Changing the port of SSH aids in avoiding automated attacks by offering 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.esds.co.in\/kb\/how-do-i-change-ssh-port-in-red-hat-enterprise-linux\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How do I Change SSH Port in Red Hat Enterprise Linux?\" \/>\n<meta property=\"og:description\" content=\"Port number 22 is the default port used by a Linux SSH Server. Changing the port of SSH aids in avoiding automated attacks by offering security..\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.esds.co.in\/kb\/how-do-i-change-ssh-port-in-red-hat-enterprise-linux\/\" \/>\n<meta property=\"og:site_name\" content=\"ESDS Official Knowledgebase\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/ESDSdc\/\" \/>\n<meta property=\"article:published_time\" content=\"2019-07-10T07:05:55+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-07-10T07:11:39+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@ESDSDataCenter\" \/>\n<meta name=\"twitter:site\" content=\"@ESDSDataCenter\" \/>\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\":\"WebSite\",\"@id\":\"https:\/\/www.esds.co.in\/kb\/#website\",\"url\":\"https:\/\/www.esds.co.in\/kb\/\",\"name\":\"ESDS Official Knowledgebase\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":\"https:\/\/www.esds.co.in\/kb\/?s={search_term_string}\",\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.esds.co.in\/kb\/how-do-i-change-ssh-port-in-red-hat-enterprise-linux\/#webpage\",\"url\":\"https:\/\/www.esds.co.in\/kb\/how-do-i-change-ssh-port-in-red-hat-enterprise-linux\/\",\"name\":\"How do I Change SSH Port in Red Hat Enterprise Linux?\",\"isPartOf\":{\"@id\":\"https:\/\/www.esds.co.in\/kb\/#website\"},\"datePublished\":\"2019-07-10T07:05:55+00:00\",\"dateModified\":\"2019-07-10T07:11:39+00:00\",\"author\":{\"@id\":\"https:\/\/www.esds.co.in\/kb\/#\/schema\/person\/6135b08d815e89f22c23132266828734\"},\"description\":\"Port number 22 is the default port used by a Linux SSH Server. Changing the port of SSH aids in avoiding automated attacks by offering security..\",\"breadcrumb\":{\"@id\":\"https:\/\/www.esds.co.in\/kb\/how-do-i-change-ssh-port-in-red-hat-enterprise-linux\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.esds.co.in\/kb\/how-do-i-change-ssh-port-in-red-hat-enterprise-linux\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.esds.co.in\/kb\/how-do-i-change-ssh-port-in-red-hat-enterprise-linux\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"item\":{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.esds.co.in\/kb\/\",\"url\":\"https:\/\/www.esds.co.in\/kb\/\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"position\":2,\"item\":{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.esds.co.in\/kb\/how-do-i-change-ssh-port-in-red-hat-enterprise-linux\/\",\"url\":\"https:\/\/www.esds.co.in\/kb\/how-do-i-change-ssh-port-in-red-hat-enterprise-linux\/\",\"name\":\"How do I Change SSH Port in Red Hat Enterprise Linux?\"}}]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.esds.co.in\/kb\/#\/schema\/person\/6135b08d815e89f22c23132266828734\",\"name\":\"ESDS\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/www.esds.co.in\/kb\/#personlogo\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/3fc2c750c42cfa0951666754ff22b33a?s=96&d=mm&r=g\",\"caption\":\"ESDS\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","_links":{"self":[{"href":"https:\/\/www.esds.co.in\/kb\/wp-json\/wp\/v2\/posts\/3815"}],"collection":[{"href":"https:\/\/www.esds.co.in\/kb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.esds.co.in\/kb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.esds.co.in\/kb\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.esds.co.in\/kb\/wp-json\/wp\/v2\/comments?post=3815"}],"version-history":[{"count":4,"href":"https:\/\/www.esds.co.in\/kb\/wp-json\/wp\/v2\/posts\/3815\/revisions"}],"predecessor-version":[{"id":3819,"href":"https:\/\/www.esds.co.in\/kb\/wp-json\/wp\/v2\/posts\/3815\/revisions\/3819"}],"wp:attachment":[{"href":"https:\/\/www.esds.co.in\/kb\/wp-json\/wp\/v2\/media?parent=3815"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.esds.co.in\/kb\/wp-json\/wp\/v2\/categories?post=3815"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.esds.co.in\/kb\/wp-json\/wp\/v2\/tags?post=3815"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}