{"id":13752,"date":"2023-04-13T08:34:57","date_gmt":"2023-04-13T08:34:57","guid":{"rendered":"https:\/\/webhostinggeeks.com\/howto\/?p=13752"},"modified":"2023-04-28T09:46:26","modified_gmt":"2023-04-28T09:46:26","slug":"how-to-enable-ssh-root-login-on-centos","status":"publish","type":"post","link":"https:\/\/webhostinggeeks.com\/howto\/how-to-enable-ssh-root-login-on-centos\/","title":{"rendered":"How to Enable SSH Root Login on CentOS"},"content":{"rendered":"<p>Secure Shell (SSH) is a widely used protocol for accessing remote machines securely over the network. It is often used to administer servers and network devices, and it provides a more secure alternative to Telnet and other remote login protocols.<\/p>\n<p>By default, most Linux distributions do not allow root logins via SSH for security reasons. This is because an attacker can use brute-force techniques to try and guess the root password, which can compromise the entire system.<\/p>\n<p>However, there are some situations where it may be necessary to enable root logins over SSH. In this guide, we will show you how to enable SSH root login on CentOS.<\/p>\n<p>Step 1: Login as Root User<\/p>\n<p>To enable SSH root login on CentOS, you must first log in as the root user. If you are currently logged in as a regular user, you can switch to the root user by running the following command:<\/p>\n<pre>\r\nsu -\r\n<\/pre>\n<p>You will then be prompted to enter the root password.<\/p>\n<p>Step 2: Edit SSH Configuration File<\/p>\n<p>Once you are logged in as the root user, you can edit the SSH configuration file to allow root logins. The configuration file is located at \/etc\/ssh\/sshd_config. You can open the file using your favorite text editor. For example, to open the file using the nano text editor, run the following command:<\/p>\n<pre>\r\nnano \/etc\/ssh\/sshd_config\r\n<\/pre>\n<p>Step 3: Enable Root Login<\/p>\n<p>In the SSH configuration file, you will need to find the line that contains the following text:<\/p>\n<pre>\r\n#PermitRootLogin yes\r\n<\/pre>\n<p>Uncomment the line by removing the &#8216;#&#8217; character and change the &#8216;no&#8217; to &#8216;yes&#8217; like below:<\/p>\n<pre>\r\nPermitRootLogin yes\r\n<\/pre>\n<p>Step 4: Restart SSH Service<\/p>\n<p>After you have made the changes to the SSH configuration file, you will need to restart the SSH service for the changes to take effect. You can do this by running the following command:<\/p>\n<pre>\r\nsystemctl restart sshd\r\n<\/pre>\n<p>Step 5: Test SSH Root Login<\/p>\n<p>Now that you have enabled root logins over SSH, you can test to make sure that everything is working as expected. From another machine, try to SSH into your CentOS server as the root user:<\/p>\n<pre>\r\nssh root@<i>your-server-ip-address<\/i>\r\n<\/pre>\n<p>If everything is working correctly, you should now be logged in as the root user over SSH.<\/p>\n<h2>Commands Mentioned:<\/h2>\n<ul>\n<li><span class=\"fw-bold\">su<\/span> &#8211; Substitute user identity<\/li>\n<li><span class=\"fw-bold\">nano<\/span> &#8211; Command-line text editor<\/li>\n<li><span class=\"fw-bold\">systemctl<\/span> &#8211; Command-line tool to manage system services<\/li>\n<\/ul>\n<h2>Conclusion:<\/h2>\n<p>Enabling SSH root login on CentOS can be useful in some situations, but it should be done with caution. By default, CentOS disables root logins over SSH to improve security. However, if you need to enable root logins for a specific task, you can easily do so by following the steps outlined in this guide. Remember to always use strong passwords and keep your system up-to-date with the latest security patches to minimize the risk of compromise.<\/p>\n<p>Please feel free to leave any comments or suggestions for improvements.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Secure Shell (SSH) is a widely used protocol for accessing remote machines securely over the network. It is often used to administer servers and network devices, and it provides a&#8230;<\/p>\n","protected":false},"author":6,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"wds_primary_category":0,"footnotes":""},"categories":[996],"tags":[1244,1720,1795],"class_list":["post-13752","post","type-post","status-publish","format-standard","hentry","category-linux","tag-centos","tag-root","tag-ssh"],"_links":{"self":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts\/13752","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/comments?post=13752"}],"version-history":[{"count":0,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts\/13752\/revisions"}],"wp:attachment":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/media?parent=13752"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/categories?post=13752"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/tags?post=13752"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}