{"id":387,"date":"2016-03-27T11:00:56","date_gmt":"2016-03-27T15:00:56","guid":{"rendered":"http:\/\/easy-admin.ca\/wordpress\/?p=387"},"modified":"2016-07-12T15:05:19","modified_gmt":"2016-07-12T19:05:19","slug":"disabling-root-ssh-access-in-centos","status":"publish","type":"post","link":"https:\/\/easy-admin.ca\/index.php\/2016\/03\/27\/disabling-root-ssh-access-in-centos\/","title":{"rendered":"Disabling Root SSH Access in CentOS"},"content":{"rendered":"<p>By default the root account automatically have SSH access remotely. After installing CentOS and the SSH server, open any SSH client and attempt to sign on as root. Access will be granted.<\/p>\n<p>To disable that, open SSH configuration file using the commands below.<\/p>\n<p><code>sudo vi \/etc\/ssh\/sshd_config<\/code><\/p>\n<p><strong>Then change the line as shown below :<\/strong><\/p>\n<p>#Authentication:<\/p>\n<p>#LoginGranceTime 2m<br \/>\n<span style=\"color: #ff0000;\">PermitRootLogin no<\/span><br \/>\n#StrictMode yes<br \/>\n#MaxAuthTries 6<br \/>\n#MaxSessions 10<\/p>\n<p>Change the highlighted line above by removing the # symbol. It should be like this:<\/p>\n<p><span style=\"color: #ff0000;\"><code>PermitRootLogin no<\/code><\/span><\/p>\n<p>Save the file and restart the SSH server by running the commands below.<\/p>\n<p><code>sudo systemctl restart sshd.service<\/code><\/p>\n<p>Now try logging in as root and you\u2019ll be denied or access won\u2019t be granted.<\/p>\n<p>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<p>Another thing to remember is that SSH traffic blocked on the firewall by default. You won\u2019t be able to access the SSH server remotely by default.<\/p>\n<p>You must enable SSH through the firewall. To do that in CentOS 7, run the commands below.<\/p>\n<p><code>firewall-cmd --permanent --zone=public --add-service=ssh<\/code><\/p>\n<p><strong>Then reload the firewall to connect.<\/strong><\/p>\n<p>firewall-cmd \u2013reload<\/p>\n<p><em><strong>That\u2019s it!<\/strong><\/em><\/p>\n<p>Enjoy!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>By default the root account automatically have SSH access remotely. After installing CentOS and the SSH server, open any SSH client and attempt to sign on as root. Access will be granted. To disable that, open SSH configuration file using the commands below. sudo vi \/etc\/ssh\/sshd_config Then change the line as shown below : #Authentication: &hellip; <a href=\"https:\/\/easy-admin.ca\/index.php\/2016\/03\/27\/disabling-root-ssh-access-in-centos\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Disabling Root SSH Access in CentOS<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-387","post","type-post","status-publish","format-standard","hentry","category-general"],"_links":{"self":[{"href":"https:\/\/easy-admin.ca\/index.php\/wp-json\/wp\/v2\/posts\/387","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/easy-admin.ca\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/easy-admin.ca\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/easy-admin.ca\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/easy-admin.ca\/index.php\/wp-json\/wp\/v2\/comments?post=387"}],"version-history":[{"count":0,"href":"https:\/\/easy-admin.ca\/index.php\/wp-json\/wp\/v2\/posts\/387\/revisions"}],"wp:attachment":[{"href":"https:\/\/easy-admin.ca\/index.php\/wp-json\/wp\/v2\/media?parent=387"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/easy-admin.ca\/index.php\/wp-json\/wp\/v2\/categories?post=387"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/easy-admin.ca\/index.php\/wp-json\/wp\/v2\/tags?post=387"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}