{"id":28342,"date":"2018-10-04T03:33:12","date_gmt":"2018-10-04T08:33:12","guid":{"rendered":"https:\/\/www.rosehosting.com\/blog\/?p=28342"},"modified":"2022-12-08T03:38:07","modified_gmt":"2022-12-08T09:38:07","slug":"disable-or-enable-ssh-root-login-and-secure-ssh-access-in-centos-7","status":"publish","type":"post","link":"https:\/\/www.rosehosting.com\/blog\/disable-or-enable-ssh-root-login-and-secure-ssh-access-in-centos-7\/","title":{"rendered":"Disable or Enable SSH Root Login and Secure SSH Access in CentOS 7"},"content":{"rendered":"<div id=\"bsf_rt_marker\"><\/div>\r\n<figure class=\"wp-block-image\"><img decoding=\"async\" width=\"742\" height=\"372\" class=\"wp-image-28471\" src=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/10\/Disable-or-Enable-SSH-Root-Login-and-Secure-SSH-Access-in-CentOS-7.jpg\" alt=\"Disable or Enable SSH Root Login and Secure SSH Access in CentOS 7\" srcset=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/10\/Disable-or-Enable-SSH-Root-Login-and-Secure-SSH-Access-in-CentOS-7.jpg 742w, https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/10\/Disable-or-Enable-SSH-Root-Login-and-Secure-SSH-Access-in-CentOS-7-150x75.jpg 150w, https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/10\/Disable-or-Enable-SSH-Root-Login-and-Secure-SSH-Access-in-CentOS-7-300x150.jpg 300w\" sizes=\"(max-width: 742px) 100vw, 742px\" \/><\/figure>\r\n\r\n\r\n\r\n<div class=\"wp-block-image\">\r\n<figure class=\"alignright\"><img decoding=\"async\" width=\"120\" height=\"104\" class=\"wp-image-28472\" src=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/10\/Disable-SSH-Root-Login-CentOS-7.jpg\" alt=\"Disable SSH Root Login CentOS 7\" \/><\/figure>\r\n<\/div>\r\n\r\n\r\n\r\n<p>We all know that CentOS comes with root access disabled for the outside world by default. This means that you can not directly log in as a root user via SSH, but you can still go ahead and utilize root privileges by using the &#8216;sudo&#8217; command instead.<\/p>\r\n\r\n\r\n\r\n<p>However, sometimes it is more convenient to log in directly as the root user. That&#8217;s why in this article, we will talk about how to enable, disable and secure the <a href=\"https:\/\/www.rosehosting.com\/blog\/ssh-login-without-password-using-ssh-keys\/\">SSH login<\/a> to your server when attempting to log in as root.<\/p>\r\n\r\n\r\n\r\n<p><!--more--><\/p>\r\n\r\n\r\n\r\n<p>Before we start, we will need several requirements to be fulfilled before continuing this tutorial.<\/p>\r\n\r\n\r\n\r\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 counter-hierarchy ez-toc-counter ez-toc-transparent ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-69ea3ba4a32a2\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"ez-toc-cssicon\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-69ea3ba4a32a2\"  aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.rosehosting.com\/blog\/disable-or-enable-ssh-root-login-and-secure-ssh-access-in-centos-7\/#Requirements\" >Requirements:<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.rosehosting.com\/blog\/disable-or-enable-ssh-root-login-and-secure-ssh-access-in-centos-7\/#Disable-SSH-Root-Login\" >Disable SSH Root Login<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.rosehosting.com\/blog\/disable-or-enable-ssh-root-login-and-secure-ssh-access-in-centos-7\/#Enable-SSH-Root-Login\" >Enable SSH Root Login<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.rosehosting.com\/blog\/disable-or-enable-ssh-root-login-and-secure-ssh-access-in-centos-7\/#Secure-SSH-Access-in-CentOS-7\" >Secure SSH Access in CentOS 7<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.rosehosting.com\/blog\/disable-or-enable-ssh-root-login-and-secure-ssh-access-in-centos-7\/#Changing-the-SSH-Server-Port\" >Changing the SSH Server Port<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.rosehosting.com\/blog\/disable-or-enable-ssh-root-login-and-secure-ssh-access-in-centos-7\/#Disabling-SSH-Protocol-1\" >Disabling SSH Protocol 1<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\" id=\"h-requirements\"><span class=\"ez-toc-section\" id=\"Requirements\"><\/span>Requirements:<span class=\"ez-toc-section-end\"><\/span><\/h2>\r\n\r\n\r\n\r\n<ul class=\"wp-block-list\">\r\n<li>Installed CentOS;<\/li>\r\n<li>Access via SSH to your VPS;<\/li>\r\n<li>A regular user that can use &#8216;su&#8217; or &#8216;sudo&#8217; to gain root privileges;<\/li>\r\n<\/ul>\r\n\r\n\r\n\r\n<p>Login to your <a href=\"https:\/\/www.rosehosting.com\/centos-hosting.html\">CentOS VPS<\/a> via SSH as a regular user with sudo privileges:<\/p>\r\n\r\n\r\n\r\n<pre class=\"wp-block-preformatted\">ssh user_name@Server_IP_Address -p Port_Number<\/pre>\r\n\r\n\r\n\r\n<h2 class=\"wp-block-heading\" id=\"h-disable-ssh-root-login\"><span class=\"ez-toc-section\" id=\"Disable-SSH-Root-Login\"><\/span>Disable SSH Root Login<span class=\"ez-toc-section-end\"><\/span><\/h2>\r\n\r\n\r\n\r\n<p>Disable SSH Root Login in CentOS 7In order to disable the root login, we need to modify the main ssh configuration file &#8220;sshd_config&#8221; with a text editor of your choice. In our example, we will use nano as an editor.<\/p>\r\n\r\n\r\n\r\n<pre class=\"wp-block-preformatted\">nano \/etc\/ssh\/sshd_config<\/pre>\r\n\r\n\r\n\r\n<p>Now search for this line below in the file.<\/p>\r\n\r\n\r\n\r\n<pre class=\"wp-block-preformatted\">#PermitRootLogin no<\/pre>\r\n\r\n\r\n\r\n<p>Uncomment the line by removing the &#8216;#&#8217; from the beginning of the line. The line in the file should look like this:<\/p>\r\n\r\n\r\n\r\n<pre class=\"wp-block-preformatted\">PermitRootLogin no<\/pre>\r\n\r\n\r\n\r\n<p>By executing the following command we will restart the SSH daemon service:<\/p>\r\n\r\n\r\n\r\n<pre class=\"wp-block-preformatted\">systemctl restart sshd.service<\/pre>\r\n\r\n\r\n\r\n<p>Now when we try to log in as the root user, you should get an &#8220;<strong>Access Denied<\/strong>&#8221; error.<\/p>\r\n\r\n\r\n\r\n<pre class=\"wp-block-preformatted\">login as: root\r\nroot@Server_IP_Address password:\r\nAccess denied\r\nroot@Server_IP_Address password:<\/pre>\r\n\r\n\r\n\r\n<p>At this point, you are not able to log in directly as root, but you can still log in as a normal user with sudo privileges and use &#8216;sudo&#8217; or &#8216;su&#8217; command to switch to the root user. For example:<\/p>\r\n\r\n\r\n\r\n<pre class=\"wp-block-preformatted\">login as: username\r\nusername@Server_IP_Address password:\r\nLast login: Wed Sep 26 12:11:38 2018 from IP_address\r\n[username@hostname ~]$ su -\r\nPassword:\r\nLast login: Thu Sep 27 11:05:19 CDT 2018 from IP_address on pts\/1\r\n[root@hostname ~]#<\/pre>\r\n\r\n\r\n\r\n<h2 class=\"wp-block-heading\" id=\"h-enable-ssh-root-login\"><span class=\"ez-toc-section\" id=\"Enable-SSH-Root-Login\"><\/span>Enable SSH Root Login<span class=\"ez-toc-section-end\"><\/span><\/h2>\r\n\r\n\r\n\r\n<div class=\"wp-block-image\">\r\n<figure class=\"alignright\"><img decoding=\"async\" width=\"150\" height=\"150\" class=\"wp-image-28473\" src=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/10\/Enable-SSH-Root-Login-CentOS-7.jpg\" alt=\"Enable SSH Root Login CentOS 7\" \/>\r\n<figcaption>Enable SSH Root Login CentOS 7<\/figcaption>\r\n<\/figure>\r\n<\/div>\r\n\r\n\r\n\r\n<p>In order to enable logging in as root, we need to modify the main ssh configuration file \u00a0&#8220;sshd_config&#8221; with a text editor of your choice. In our example, we will use nano as an editor.<\/p>\r\n\r\n\r\n\r\n<pre class=\"wp-block-preformatted\">nano \/etc\/ssh\/sshd_config<\/pre>\r\n\r\n\r\n\r\n<p>Find the following line in the file.<\/p>\r\n\r\n\r\n\r\n<pre class=\"wp-block-preformatted\">PermitRootLogin no<\/pre>\r\n\r\n\r\n\r\n<p>Comment the line out by adding a &#8216;#&#8217; at the beginning of the line, or change &#8216;no&#8217; to &#8216;yes&#8217; like in the examples shown below.<\/p>\r\n\r\n\r\n\r\n<pre class=\"wp-block-preformatted\">#PermitRootLogin no<\/pre>\r\n\r\n\r\n\r\n<p>or<\/p>\r\n\r\n\r\n\r\n<pre class=\"wp-block-preformatted\">PermitRootLogin yes<\/pre>\r\n\r\n\r\n\r\n<p>After we save the file we should restart the sshd service.<\/p>\r\n\r\n\r\n\r\n<pre class=\"wp-block-preformatted\">systemctl restart sshd.service<\/pre>\r\n\r\n\r\n\r\n<p>You can now try to log in directly as a root user.<\/p>\r\n\r\n\r\n\r\n<pre class=\"wp-block-preformatted\">login as: root\r\nroot@Server_IP_Address password:\r\nLast login: Wed Sep 27 12:22:50 2018 from IP_address\r\n[root@hostname ~]#<\/pre>\r\n\r\n\r\n\r\n<h2 class=\"wp-block-heading\" id=\"h-secure-ssh-access-in-centos-7\"><span class=\"ez-toc-section\" id=\"Secure-SSH-Access-in-CentOS-7\"><\/span>Secure SSH Access in CentOS 7<span class=\"ez-toc-section-end\"><\/span><\/h2>\r\n\r\n\r\n\r\n<p>In this section, we will provide you with a few simple tips on how to secure SSH access on your CentOS 7 server.<\/p>\r\n\r\n\r\n\r\n<h2 class=\"wp-block-heading\" id=\"h-changing-the-ssh-server-port\"><span class=\"ez-toc-section\" id=\"Changing-the-SSH-Server-Port\"><\/span>Changing the SSH Server Port<span class=\"ez-toc-section-end\"><\/span><\/h2>\r\n\r\n\r\n\r\n<p>In order to change the Standard listening Port, you need to modify the SSH configuration file by using the command below:<\/p>\r\n\r\n\r\n\r\n<pre class=\"wp-block-preformatted\">nano \/etc\/ssh\/sshd_config<\/pre>\r\n\r\n\r\n\r\n<div class=\"wp-block-image\">\r\n<figure class=\"alignright\"><img decoding=\"async\" width=\"100\" height=\"100\" class=\"wp-image-28476\" src=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/10\/secure-ssh-access-in-centos-7.jpg\" alt=\"secure ssh access in centos 7\" \/><\/figure>\r\n<\/div>\r\n\r\n\r\n\r\n<p>Next, you need to find the line that refers to the port number. After you find the port number (the default value should be 22), you can edit the default one to the number you prefer.<\/p>\r\n\r\n\r\n\r\n<p>When you are finished with editing, press Ctrl+O, and then press Ctrl+X in order to save and exit.<\/p>\r\n\r\n\r\n\r\n<p>Restart the SSH daemon service by executing the command:<\/p>\r\n\r\n\r\n\r\n<pre class=\"wp-block-preformatted\">systemctl restart sshd.service<\/pre>\r\n\r\n\r\n\r\n<h2 class=\"wp-block-heading\" id=\"h-disabling-ssh-protocol-1\"><span class=\"ez-toc-section\" id=\"Disabling-SSH-Protocol-1\"><\/span>Disabling SSH Protocol 1<span class=\"ez-toc-section-end\"><\/span><\/h2>\r\n\r\n\r\n\r\n<p>There are two versions of SSH protocols: SSHv1, and SSHv2. Using the SSHv1 protocol is not recommended because it&#8217;s an older version and is less secure than the newer SSHv2 protocol. In the next section, we will disable SSHv1. If you need this version for any reason, then you can ignore this part.<\/p>\r\n\r\n\r\n\r\n<p>Open the SSH configuration file with this command:<\/p>\r\n\r\n\r\n\r\n<pre class=\"wp-block-preformatted\">nano \/etc\/ssh\/sshd_config<\/pre>\r\n\r\n\r\n\r\n<p>Uncomment the line<\/p>\r\n\r\n\r\n\r\n<pre class=\"wp-block-preformatted\">Protocol 2,1<\/pre>\r\n\r\n\r\n\r\n<p>and edit it to:<\/p>\r\n\r\n\r\n\r\n<pre class=\"wp-block-preformatted\">Protocol 2<\/pre>\r\n\r\n\r\n\r\n<p>Now we should restart the SSH service in order for the new configuration to take effect. We can do that by\u00a0executing this command:<\/p>\r\n\r\n\r\n\r\n<pre class=\"wp-block-preformatted\">systemctl restart sshd.service<\/pre>\r\n\r\n\r\n\r\n<p>Disabling root access is also one of the ways to secure your SSH server, which we showed you at the beginning of the article.<\/p>\r\n\r\n\r\n\r\n<p>In this tutorial, we learned how to disable and enable the root login in SSH.<br \/>We also learned how to secure the SSH server by changing the port number, disabling root access, and disabling the SSH protocol SSHv1.<\/p>\r\n\r\n\r\n<hr class=\"wp-block-separator\" \/>\r\n\r\n\r\n<div class=\"wp-block-image\">\r\n<figure class=\"alignright\"><img decoding=\"async\" width=\"150\" height=\"150\" class=\"wp-image-28475\" src=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/10\/Disable-Enable-SSH-Root-Login-CentOS-7.jpg\" alt=\"Disable or Enable SSH Root Login and Secure SSH Access in CentOS 7\" \/><\/figure>\r\n<\/div>\r\n\r\n\r\n\r\n<p>If you are one of our <a href=\"https:\/\/www.rosehosting.com\">managed VPS hosting<\/a> clients, you can simply ask our system administrators to <strong>Enable or Disable root login through SSH on your CentOS server<\/strong>. They are available 24\/7 and will take care of your request immediately.<\/p>\r\n\r\n\r\n\r\n<p>If you find this blog post useful, please share it with your friends via social media networks, or if you have any questions please leave a comment below and we will reply to it. Thanks!<\/p>\r\n","protected":false},"excerpt":{"rendered":"<p>We all know that CentOS comes with root access disabled for the outside world by default. This means that you &#8230; <\/p>\n<p class=\"read-more-container\"><a title=\"Disable or Enable SSH Root Login and Secure SSH Access in CentOS 7\" class=\"read-more button\" href=\"https:\/\/www.rosehosting.com\/blog\/disable-or-enable-ssh-root-login-and-secure-ssh-access-in-centos-7\/#more-28342\" aria-label=\"Read more about Disable or Enable SSH Root Login and Secure SSH Access in CentOS 7\">Read More<\/a><\/p>\n","protected":false},"author":4,"featured_media":28471,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1699,1703],"tags":[34,1754,1755,1562],"class_list":["post-28342","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-centos","category-security","tag-centos","tag-disable-root","tag-enable-root-login","tag-secure-ssh","generate-columns","tablet-grid-50","mobile-grid-100","grid-parent","grid-33"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.4 (Yoast SEO v27.4) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Disable or Enable SSH Root Login And Secure SSH Access in CentOS 7<\/title>\n<meta name=\"description\" content=\"Learn how to disable and enable SSH root login, and secure SSH access on a CentOS 7. this tutorial provides instructions.\" \/>\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.rosehosting.com\/blog\/disable-or-enable-ssh-root-login-and-secure-ssh-access-in-centos-7\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Disable or Enable SSH Root Login and Secure SSH Access in CentOS 7\" \/>\n<meta property=\"og:description\" content=\"Disable or Enable SSH Root Login and Secure SSH Access in CentOS 7 | RoseHosting\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.rosehosting.com\/blog\/disable-or-enable-ssh-root-login-and-secure-ssh-access-in-centos-7\/\" \/>\n<meta property=\"og:site_name\" content=\"RoseHosting\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/RoseHosting\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/rosehosting.helpdesk\" \/>\n<meta property=\"article:published_time\" content=\"2018-10-04T08:33:12+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-12-08T09:38:07+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/10\/Disable-or-Enable-SSH-Root-Login-and-Secure-SSH-Access-in-CentOS-7.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"742\" \/>\n\t<meta property=\"og:image:height\" content=\"372\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Jeff Wilson\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@rosehosting\" \/>\n<meta name=\"twitter:site\" content=\"@rosehosting\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Jeff Wilson\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/disable-or-enable-ssh-root-login-and-secure-ssh-access-in-centos-7\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/disable-or-enable-ssh-root-login-and-secure-ssh-access-in-centos-7\\\/\"},\"author\":{\"name\":\"Jeff Wilson\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#\\\/schema\\\/person\\\/7ce77a842fa6a9a7f8efa186f2353713\"},\"headline\":\"Disable or Enable SSH Root Login and Secure SSH Access in CentOS 7\",\"datePublished\":\"2018-10-04T08:33:12+00:00\",\"dateModified\":\"2022-12-08T09:38:07+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/disable-or-enable-ssh-root-login-and-secure-ssh-access-in-centos-7\\\/\"},\"wordCount\":748,\"commentCount\":2,\"publisher\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/disable-or-enable-ssh-root-login-and-secure-ssh-access-in-centos-7\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/10\\\/Disable-or-Enable-SSH-Root-Login-and-Secure-SSH-Access-in-CentOS-7.jpg\",\"keywords\":[\"centos\",\"disable root\",\"enable root login\",\"secure SSH\"],\"articleSection\":[\"CentOS\",\"Security\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/disable-or-enable-ssh-root-login-and-secure-ssh-access-in-centos-7\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/disable-or-enable-ssh-root-login-and-secure-ssh-access-in-centos-7\\\/\",\"url\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/disable-or-enable-ssh-root-login-and-secure-ssh-access-in-centos-7\\\/\",\"name\":\"Disable or Enable SSH Root Login And Secure SSH Access in CentOS 7\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/disable-or-enable-ssh-root-login-and-secure-ssh-access-in-centos-7\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/disable-or-enable-ssh-root-login-and-secure-ssh-access-in-centos-7\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/10\\\/Disable-or-Enable-SSH-Root-Login-and-Secure-SSH-Access-in-CentOS-7.jpg\",\"datePublished\":\"2018-10-04T08:33:12+00:00\",\"dateModified\":\"2022-12-08T09:38:07+00:00\",\"description\":\"Learn how to disable and enable SSH root login, and secure SSH access on a CentOS 7. this tutorial provides instructions.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/disable-or-enable-ssh-root-login-and-secure-ssh-access-in-centos-7\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/disable-or-enable-ssh-root-login-and-secure-ssh-access-in-centos-7\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/disable-or-enable-ssh-root-login-and-secure-ssh-access-in-centos-7\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/10\\\/Disable-or-Enable-SSH-Root-Login-and-Secure-SSH-Access-in-CentOS-7.jpg\",\"contentUrl\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/10\\\/Disable-or-Enable-SSH-Root-Login-and-Secure-SSH-Access-in-CentOS-7.jpg\",\"width\":742,\"height\":372,\"caption\":\"Disable or Enable SSH Root Login and Secure SSH Access in CentOS 7\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/disable-or-enable-ssh-root-login-and-secure-ssh-access-in-centos-7\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Disable or Enable SSH Root Login and Secure SSH Access in CentOS 7\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/\",\"name\":\"RoseHosting.com\",\"description\":\"Premium Linux Tutorials Since 2001\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#organization\",\"name\":\"RoseHosting\",\"url\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/03\\\/android-chrome-192x192-1.png\",\"contentUrl\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/03\\\/android-chrome-192x192-1.png\",\"width\":192,\"height\":192,\"caption\":\"RoseHosting\"},\"image\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/RoseHosting\",\"https:\\\/\\\/x.com\\\/rosehosting\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/rosehosting\\\/\"],\"description\":\"RoseHosting is a leading Linux hosting provider, serving thousands of clients world-wide since 2001.\",\"email\":\"info@rosehosting.com\",\"telephone\":\"(314) 275-0414\",\"legalName\":\"Rose Web Services LLC\",\"foundingDate\":\"2001-04-02\",\"numberOfEmployees\":{\"@type\":\"QuantitativeValue\",\"minValue\":\"11\",\"maxValue\":\"50\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#\\\/schema\\\/person\\\/7ce77a842fa6a9a7f8efa186f2353713\",\"name\":\"Jeff Wilson\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/0985fed6af04cc60703d2ecf27c65dfa373e0ca00eb21c0b03477e099ea3f99f?s=96&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/0985fed6af04cc60703d2ecf27c65dfa373e0ca00eb21c0b03477e099ea3f99f?s=96&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/0985fed6af04cc60703d2ecf27c65dfa373e0ca00eb21c0b03477e099ea3f99f?s=96&r=g\",\"caption\":\"Jeff Wilson\"},\"description\":\"An experienced Linux veteran with many years of experience. Helping other Linux admins with frequent Linux and business-related blog posts on the RoseHosting blog. Techie by choice. Loving nature and travel. Happily married and father of two lovely children.\",\"sameAs\":[\"https:\\\/\\\/www.rosehosting.com\",\"https:\\\/\\\/www.facebook.com\\\/rosehosting.helpdesk\"],\"url\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/author\\\/jwilson\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Disable or Enable SSH Root Login And Secure SSH Access in CentOS 7","description":"Learn how to disable and enable SSH root login, and secure SSH access on a CentOS 7. this tutorial provides instructions.","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.rosehosting.com\/blog\/disable-or-enable-ssh-root-login-and-secure-ssh-access-in-centos-7\/","og_locale":"en_US","og_type":"article","og_title":"Disable or Enable SSH Root Login and Secure SSH Access in CentOS 7","og_description":"Disable or Enable SSH Root Login and Secure SSH Access in CentOS 7 | RoseHosting","og_url":"https:\/\/www.rosehosting.com\/blog\/disable-or-enable-ssh-root-login-and-secure-ssh-access-in-centos-7\/","og_site_name":"RoseHosting","article_publisher":"https:\/\/www.facebook.com\/RoseHosting","article_author":"https:\/\/www.facebook.com\/rosehosting.helpdesk","article_published_time":"2018-10-04T08:33:12+00:00","article_modified_time":"2022-12-08T09:38:07+00:00","og_image":[{"width":742,"height":372,"url":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/10\/Disable-or-Enable-SSH-Root-Login-and-Secure-SSH-Access-in-CentOS-7.jpg","type":"image\/jpeg"}],"author":"Jeff Wilson","twitter_card":"summary_large_image","twitter_creator":"@rosehosting","twitter_site":"@rosehosting","twitter_misc":{"Written by":"Jeff Wilson","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.rosehosting.com\/blog\/disable-or-enable-ssh-root-login-and-secure-ssh-access-in-centos-7\/#article","isPartOf":{"@id":"https:\/\/www.rosehosting.com\/blog\/disable-or-enable-ssh-root-login-and-secure-ssh-access-in-centos-7\/"},"author":{"name":"Jeff Wilson","@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/person\/7ce77a842fa6a9a7f8efa186f2353713"},"headline":"Disable or Enable SSH Root Login and Secure SSH Access in CentOS 7","datePublished":"2018-10-04T08:33:12+00:00","dateModified":"2022-12-08T09:38:07+00:00","mainEntityOfPage":{"@id":"https:\/\/www.rosehosting.com\/blog\/disable-or-enable-ssh-root-login-and-secure-ssh-access-in-centos-7\/"},"wordCount":748,"commentCount":2,"publisher":{"@id":"https:\/\/www.rosehosting.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.rosehosting.com\/blog\/disable-or-enable-ssh-root-login-and-secure-ssh-access-in-centos-7\/#primaryimage"},"thumbnailUrl":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/10\/Disable-or-Enable-SSH-Root-Login-and-Secure-SSH-Access-in-CentOS-7.jpg","keywords":["centos","disable root","enable root login","secure SSH"],"articleSection":["CentOS","Security"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.rosehosting.com\/blog\/disable-or-enable-ssh-root-login-and-secure-ssh-access-in-centos-7\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.rosehosting.com\/blog\/disable-or-enable-ssh-root-login-and-secure-ssh-access-in-centos-7\/","url":"https:\/\/www.rosehosting.com\/blog\/disable-or-enable-ssh-root-login-and-secure-ssh-access-in-centos-7\/","name":"Disable or Enable SSH Root Login And Secure SSH Access in CentOS 7","isPartOf":{"@id":"https:\/\/www.rosehosting.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.rosehosting.com\/blog\/disable-or-enable-ssh-root-login-and-secure-ssh-access-in-centos-7\/#primaryimage"},"image":{"@id":"https:\/\/www.rosehosting.com\/blog\/disable-or-enable-ssh-root-login-and-secure-ssh-access-in-centos-7\/#primaryimage"},"thumbnailUrl":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/10\/Disable-or-Enable-SSH-Root-Login-and-Secure-SSH-Access-in-CentOS-7.jpg","datePublished":"2018-10-04T08:33:12+00:00","dateModified":"2022-12-08T09:38:07+00:00","description":"Learn how to disable and enable SSH root login, and secure SSH access on a CentOS 7. this tutorial provides instructions.","breadcrumb":{"@id":"https:\/\/www.rosehosting.com\/blog\/disable-or-enable-ssh-root-login-and-secure-ssh-access-in-centos-7\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.rosehosting.com\/blog\/disable-or-enable-ssh-root-login-and-secure-ssh-access-in-centos-7\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.rosehosting.com\/blog\/disable-or-enable-ssh-root-login-and-secure-ssh-access-in-centos-7\/#primaryimage","url":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/10\/Disable-or-Enable-SSH-Root-Login-and-Secure-SSH-Access-in-CentOS-7.jpg","contentUrl":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2018\/10\/Disable-or-Enable-SSH-Root-Login-and-Secure-SSH-Access-in-CentOS-7.jpg","width":742,"height":372,"caption":"Disable or Enable SSH Root Login and Secure SSH Access in CentOS 7"},{"@type":"BreadcrumbList","@id":"https:\/\/www.rosehosting.com\/blog\/disable-or-enable-ssh-root-login-and-secure-ssh-access-in-centos-7\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.rosehosting.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Disable or Enable SSH Root Login and Secure SSH Access in CentOS 7"}]},{"@type":"WebSite","@id":"https:\/\/www.rosehosting.com\/blog\/#website","url":"https:\/\/www.rosehosting.com\/blog\/","name":"RoseHosting.com","description":"Premium Linux Tutorials Since 2001","publisher":{"@id":"https:\/\/www.rosehosting.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.rosehosting.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.rosehosting.com\/blog\/#organization","name":"RoseHosting","url":"https:\/\/www.rosehosting.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2022\/03\/android-chrome-192x192-1.png","contentUrl":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2022\/03\/android-chrome-192x192-1.png","width":192,"height":192,"caption":"RoseHosting"},"image":{"@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/RoseHosting","https:\/\/x.com\/rosehosting","https:\/\/www.linkedin.com\/in\/rosehosting\/"],"description":"RoseHosting is a leading Linux hosting provider, serving thousands of clients world-wide since 2001.","email":"info@rosehosting.com","telephone":"(314) 275-0414","legalName":"Rose Web Services LLC","foundingDate":"2001-04-02","numberOfEmployees":{"@type":"QuantitativeValue","minValue":"11","maxValue":"50"}},{"@type":"Person","@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/person\/7ce77a842fa6a9a7f8efa186f2353713","name":"Jeff Wilson","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/0985fed6af04cc60703d2ecf27c65dfa373e0ca00eb21c0b03477e099ea3f99f?s=96&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/0985fed6af04cc60703d2ecf27c65dfa373e0ca00eb21c0b03477e099ea3f99f?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/0985fed6af04cc60703d2ecf27c65dfa373e0ca00eb21c0b03477e099ea3f99f?s=96&r=g","caption":"Jeff Wilson"},"description":"An experienced Linux veteran with many years of experience. Helping other Linux admins with frequent Linux and business-related blog posts on the RoseHosting blog. Techie by choice. Loving nature and travel. Happily married and father of two lovely children.","sameAs":["https:\/\/www.rosehosting.com","https:\/\/www.facebook.com\/rosehosting.helpdesk"],"url":"https:\/\/www.rosehosting.com\/blog\/author\/jwilson\/"}]}},"_links":{"self":[{"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/posts\/28342","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/comments?post=28342"}],"version-history":[{"count":7,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/posts\/28342\/revisions"}],"predecessor-version":[{"id":43784,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/posts\/28342\/revisions\/43784"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/media\/28471"}],"wp:attachment":[{"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/media?parent=28342"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/categories?post=28342"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/tags?post=28342"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}