{"id":163,"date":"2021-10-28T05:56:33","date_gmt":"2021-10-28T05:56:33","guid":{"rendered":"http:\/\/webhostingpune.co.in\/blog\/?p=163"},"modified":"2021-10-28T05:57:09","modified_gmt":"2021-10-28T05:57:09","slug":"how-to-disable-root-ssh-access","status":"publish","type":"post","link":"https:\/\/webhostingpune.co.in\/blog\/how-to-disable-root-ssh-access\/","title":{"rendered":"How To Disable Root SSH Access"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">By default when you install CentOS 7 and SSH server, the root account automatically have remote access via SSH. This can be dangerous. If the root account password falls into the wrong hands, your server is at the mercy of the bad guys with the password. They can delete every file and folder on the server and take down the entire system with few commands. That\u2019s why limiting the root account from directly accessing the server is recommended. I will show you through the step by step disable root SSH access on a CentOS 7 server.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Before you disable SSH logins for the root account, you must create a normal user account. (Otherwise, you will be unable to access your server when you disable the root account for SSH logins.<br><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Disable Root SSH Access on CentOS 7<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Step 1. First let\u2019s start by ensuring your system is up-to-date.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>yum clean all\nyum -y update<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Step 2. Disable Root SSH Access.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To disable that, open SSH configuration file using the commands below:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>nano \/etc\/ssh\/sshd_config<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Modify the line as follows:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>PermitRootLogin no<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Save the file and restart the SSH server by running the commands below:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>systemctl restart sshd.service<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">To re-enable the root account, just put the # symbol for the PermitRootLogin directive in the file and save it. The restart SSH server.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You have successfully disable root SSH access.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Hope this blog is helpful !!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>By default when you install CentOS 7 and SSH server, the root account automatically have remote access via SSH. This can be dangerous. If the root account password falls into the wrong hands, your server is at the mercy of the bad guys with the password. They can delete every file and folder on the server and take down the entire system with few commands. That\u2019s why limiting the root account from directly accessing the server is recommended. I will show you through the step by step disable root SSH access on a CentOS 7 server. Before you disable SSH logins for the root account, you must create a normal user account. (Otherwise, you will be unable to access your server when you disable the root account for SSH logins. Disable Root SSH Access on CentOS 7 Step 1. First let\u2019s start by ensuring your system is up-to-date. Step 2. Disable Root SSH Access. To disable that, open SSH configuration file using the commands below: Modify the line as follows: Save the file and restart the SSH server by running the commands below: To re-enable the root account, just put the # symbol for the PermitRootLogin directive in the file and save it. The restart SSH server. You have successfully disable root SSH access. Hope this blog is helpful !!<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_crdt_document":"","footnotes":""},"categories":[1],"tags":[],"class_list":["post-163","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/webhostingpune.co.in\/blog\/wp-json\/wp\/v2\/posts\/163","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webhostingpune.co.in\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webhostingpune.co.in\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webhostingpune.co.in\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/webhostingpune.co.in\/blog\/wp-json\/wp\/v2\/comments?post=163"}],"version-history":[{"count":2,"href":"https:\/\/webhostingpune.co.in\/blog\/wp-json\/wp\/v2\/posts\/163\/revisions"}],"predecessor-version":[{"id":165,"href":"https:\/\/webhostingpune.co.in\/blog\/wp-json\/wp\/v2\/posts\/163\/revisions\/165"}],"wp:attachment":[{"href":"https:\/\/webhostingpune.co.in\/blog\/wp-json\/wp\/v2\/media?parent=163"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webhostingpune.co.in\/blog\/wp-json\/wp\/v2\/categories?post=163"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webhostingpune.co.in\/blog\/wp-json\/wp\/v2\/tags?post=163"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}