{"id":1883,"date":"2021-09-14T12:34:07","date_gmt":"2021-09-14T12:34:07","guid":{"rendered":"https:\/\/ownwebservers.com\/kb\/?p=1883"},"modified":"2021-09-14T12:36:09","modified_gmt":"2021-09-14T12:36:09","slug":"steps-to-change-ssh-port-in-red-hat-enterprise-linux","status":"publish","type":"post","link":"https:\/\/ownwebservers.com\/kb\/steps-to-change-ssh-port-in-red-hat-enterprise-linux\/","title":{"rendered":"Steps to Change SSH Port in Red Hat Enterprise Linux"},"content":{"rendered":"<p>Earlier, we&#8217;ve had a look at the <a href=\"https:\/\/ownwebservers.com\/kb\/?p=1714\">Steps to Change SSH Port of a Linux Server<\/a> from the default port 22 to one thing of your preference. The steps described in this should are useful, however it there weren\u2019t due the actual fact that you simply have RHEL 6 installed on the server, then you almost certainly would have encountered an error stating the <strong>denial of permissions<\/strong>.<\/p>\n<p>This is as a result of the Security Enhanced Linux or SELinux is enabled over your server. This is often essentially a default feature that comes equipped with Red Hat Enterprise Linux that is answerable for blocking every port that provides access to SSH, only the port 22 is provide this capability by default.<\/p>\n<p>If you would like to use the other port, few changes within the settings ar needed. the subsequent steps would assist you change your SSH Port in SELinux<\/p>\n<p><strong>Step 1<\/strong> : Login as Root<\/p>\n<p><strong>Step 2<\/strong>: To check the settings of the port that you currently Run semanage. As root, type:<\/p>\n<blockquote><p><span style=\"color: #3366ff;\"><strong>semanage port -l | grep ssh<\/strong><\/span><\/p><\/blockquote>\n<p>The similar command as shown below should be able to see:<\/p>\n<blockquote><p><span style=\"color: #3366ff;\"><strong>ssh_port_t tcp 22<\/strong><\/span><\/p><\/blockquote>\n<p><strong>Step 3<\/strong>: Here, you have to proceed with adding your required port. Use the below command to try to do so:<\/p>\n<blockquote><p><span style=\"color: #3366ff;\"><strong>semanage port -a -t ssh_port_t -p tcp 1234<\/strong><\/span><\/p><\/blockquote>\n<p><strong>Note<\/strong> : You have to just make a small change by replacing 1234 with the port number of your preference<\/p>\n<p><strong>Step 4<\/strong> : By using the following command run a quick check to ensure that the port has been added to acceptable port list:<\/p>\n<blockquote><p><span style=\"color: #3366ff;\"><strong>semanage port -l | grep ssh<\/strong><\/span><\/p><\/blockquote>\n<p>You should be able to see that the desired port has been added by execution of the command :<\/p>\n<blockquote><p><span style=\"color: #3366ff;\"><strong>ssh_port_t tcp 1234,22<\/strong><\/span><\/p><\/blockquote>\n<p><strong>Step 5<\/strong> : For the changes to apply restart OpenSSH using the following command :<\/p>\n<blockquote><p><span style=\"color: #3366ff;\"><strong>\/sbin\/service sshd restart<\/strong><\/span><\/p><\/blockquote>\n<p>This will permit you to access SSH via. your required port. You furthermore should make sure that the SSH is well configured and also the port is enabled within the firewall settings as well.<\/p>\n<p>You may contact our support department for any help with this. You can also raise a ticket via. helpdesk, drop an email to support@ownwebservers.com or reach via. Live Chat. we provide around the clock <a href=\"https:\/\/ownwebservers.com\/web-hosting\/\">web hosting<\/a> services and take privilege in serving to you get the problem resolved at the earliest.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Earlier, we&#8217;ve had a look at the Steps to Change SSH Port of a Linux Server from the default port 22 to one thing of your preference. The steps described in this should are useful, however it there weren\u2019t due the actual fact that you simply have RHEL 6 installed on the server, then you [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[21,23],"tags":[],"class_list":["post-1883","post","type-post","status-publish","format-standard","hentry","category-tech-support","category-tutorials"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v15.2.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Steps to Change SSH Port in Red Hat Enterprise Linux - OWS KB<\/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:\/\/ownwebservers.com\/kb\/steps-to-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=\"Steps to Change SSH Port in Red Hat Enterprise Linux - OWS KB\" \/>\n<meta property=\"og:description\" content=\"Earlier, we&#8217;ve had a look at the Steps to Change SSH Port of a Linux Server from the default port 22 to one thing of your preference. The steps described in this should are useful, however it there weren\u2019t due the actual fact that you simply have RHEL 6 installed on the server, then you [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/ownwebservers.com\/kb\/steps-to-change-ssh-port-in-red-hat-enterprise-linux\/\" \/>\n<meta property=\"og:site_name\" content=\"OWS KB\" \/>\n<meta property=\"article:published_time\" content=\"2021-09-14T12:34:07+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-09-14T12:36:09+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\">\n\t<meta name=\"twitter:data1\" content=\"admin\">\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\":\"WebSite\",\"@id\":\"https:\/\/ownwebservers.com\/kb\/#website\",\"url\":\"https:\/\/ownwebservers.com\/kb\/\",\"name\":\"OWS KB\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":\"https:\/\/ownwebservers.com\/kb\/?s={search_term_string}\",\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/ownwebservers.com\/kb\/steps-to-change-ssh-port-in-red-hat-enterprise-linux\/#webpage\",\"url\":\"https:\/\/ownwebservers.com\/kb\/steps-to-change-ssh-port-in-red-hat-enterprise-linux\/\",\"name\":\"Steps to Change SSH Port in Red Hat Enterprise Linux - OWS KB\",\"isPartOf\":{\"@id\":\"https:\/\/ownwebservers.com\/kb\/#website\"},\"datePublished\":\"2021-09-14T12:34:07+00:00\",\"dateModified\":\"2021-09-14T12:36:09+00:00\",\"author\":{\"@id\":\"https:\/\/ownwebservers.com\/kb\/#\/schema\/person\/4a40fe3fe17a08ddd1d7c113668e75f2\"},\"breadcrumb\":{\"@id\":\"https:\/\/ownwebservers.com\/kb\/steps-to-change-ssh-port-in-red-hat-enterprise-linux\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/ownwebservers.com\/kb\/steps-to-change-ssh-port-in-red-hat-enterprise-linux\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/ownwebservers.com\/kb\/steps-to-change-ssh-port-in-red-hat-enterprise-linux\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"item\":{\"@type\":\"WebPage\",\"@id\":\"https:\/\/ownwebservers.com\/kb\/\",\"url\":\"https:\/\/ownwebservers.com\/kb\/\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"position\":2,\"item\":{\"@type\":\"WebPage\",\"@id\":\"https:\/\/ownwebservers.com\/kb\/steps-to-change-ssh-port-in-red-hat-enterprise-linux\/\",\"url\":\"https:\/\/ownwebservers.com\/kb\/steps-to-change-ssh-port-in-red-hat-enterprise-linux\/\",\"name\":\"Steps to Change SSH Port in Red Hat Enterprise Linux\"}}]},{\"@type\":\"Person\",\"@id\":\"https:\/\/ownwebservers.com\/kb\/#\/schema\/person\/4a40fe3fe17a08ddd1d7c113668e75f2\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/ownwebservers.com\/kb\/#personlogo\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/ba5db5841d48bd7517bb2583e13983e6d2fa56a4099a0b3c61ad2daefc321303?s=96&d=mm&r=g\",\"caption\":\"admin\"},\"sameAs\":[\"https:\/\/ownwebservers.com\/kb\"]}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","_links":{"self":[{"href":"https:\/\/ownwebservers.com\/kb\/wp-json\/wp\/v2\/posts\/1883","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ownwebservers.com\/kb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ownwebservers.com\/kb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ownwebservers.com\/kb\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ownwebservers.com\/kb\/wp-json\/wp\/v2\/comments?post=1883"}],"version-history":[{"count":4,"href":"https:\/\/ownwebservers.com\/kb\/wp-json\/wp\/v2\/posts\/1883\/revisions"}],"predecessor-version":[{"id":1887,"href":"https:\/\/ownwebservers.com\/kb\/wp-json\/wp\/v2\/posts\/1883\/revisions\/1887"}],"wp:attachment":[{"href":"https:\/\/ownwebservers.com\/kb\/wp-json\/wp\/v2\/media?parent=1883"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ownwebservers.com\/kb\/wp-json\/wp\/v2\/categories?post=1883"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ownwebservers.com\/kb\/wp-json\/wp\/v2\/tags?post=1883"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}