{"id":6895,"date":"2019-12-11T07:20:00","date_gmt":"2019-12-11T07:20:00","guid":{"rendered":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/?p=6895"},"modified":"2022-02-15T08:01:44","modified_gmt":"2022-02-15T08:01:44","slug":"disable-ssh-login-for-the-root-user","status":"publish","type":"post","link":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/disable-ssh-login-for-the-root-user\/","title":{"rendered":"Disable SSH Login for the Root User"},"content":{"rendered":"<p>In this article, we will see how to disable SSH root login to your server.<\/p>\n<p>There can be direct root access without any restrictions, which is a major drawback from the security point of view. This is an open opportunity for hackers as they can brute force your root password and potentially get access to your server if the password can be guessed. That&#8217;s the reason the SSH login needs to be disabled.<\/p>\n<h3>Steps to disable SSH login for the Root User are :<\/h3>\n<p>1) Login to the server through SSH.<\/p>\n<div style=\"background-color: #e0ffff; padding: 10px;\"><strong>Note:<\/strong> You need to get more than one terminal access to the server because in case one connection gets lost you can recover and get access to the server with the other one.<\/div>\n<p>2) Open the file &#8220;\/etc\/ssh\/sshd_config&#8221; (SSH configuration file) in any of the text editor using the command :<\/p>\n<div style=\"background-color: #e0ffff; padding: 10px;\"><strong>vi \/etc\/ssh\/sshd_config<\/strong><\/div>\n<p>3) Locate the directive PermitRoootLogin using the command :<\/p>\n<div style=\"background-color: #e0ffff; padding: 10px;\"><strong>#PermitRootLogin yes<\/strong><\/div>\n<p>3) Uncomment this line and change the directive to No as:<\/p>\n<div style=\"background-color: #e0ffff; padding: 10px;\"><strong>PermitRootLogin no<\/strong><\/div>\n<p>4) Save and close the file. Restart the SSH and save the changes by executing any one of the commands below :<\/p>\n<div style=\"background-color: #e0ffff; padding: 10px;\"><strong>\/etc\/init.d\/sshd restart<\/strong><\/div>\n<div style=\"background-color: #e0ffff; padding: 10px;\">\n<p><strong>systemctl restart sshd<\/strong><\/p>\n<p><strong>service sshd restart<\/strong><\/p>\n<\/div>\n<p>That&#8217;s it.<\/p>\n<p>Now onwards, any attempt to SSH to the server with the root account will automatically be denied.<\/p>\n<p><a href=\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-content\/uploads\/2019\/12\/ssh-login.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-13378\" src=\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-content\/uploads\/2019\/12\/ssh-login.jpg\" alt=\"ssh login\" width=\"549\" height=\"148\" srcset=\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-content\/uploads\/2019\/12\/ssh-login.jpg 549w, https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-content\/uploads\/2019\/12\/ssh-login-300x81.jpg 300w\" sizes=\"auto, (max-width: 549px) 100vw, 549px\" \/><\/a><\/p>\n<p>Now, you will not be able to SSH to the server with the root account.<\/p>\n<p><strong>Also Read :<\/strong><\/p>\n<p><a href=\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/how-to-use-ssh-on-windows-putty\/\" target=\"_blank\" rel=\"noopener\"> <strong> How to use SSH on Windows PuTTY?<\/strong><\/a><\/p>\n<p><a href=\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/steps-to-create-a-phprc-file-via-ssh\/\" target=\"_blank\" rel=\"noopener\"><strong> Steps to Create a phprc file via SSH<\/strong><\/a><\/p>\n<p><a href=\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/how-to-optimize-a-mysql-database-using-ssh\/\" target=\"_blank\" rel=\"noopener\"><strong> How to Optimize a MySQL Database Using SSH?<\/strong><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this article, we will see how to disable SSH root login to your server. There can be direct root access without any restrictions, which is a major drawback from the security point of view. This is an open opportunity for hackers as they can brute force your root password and potentially get access to [&hellip;]<\/p>\n","protected":false},"author":18,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[41],"tags":[1138,1139,1140],"class_list":["post-6895","post","type-post","status-publish","format-standard","placeholder-for-hentry","category-howtos","tag-disable-ssh-login","tag-disable-ssh-login-for-root-user","tag-root-user"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Disable SSH Login for the Root User - Web Hosting FAQs by MilesWeb<\/title>\n<meta name=\"description\" content=\"The article guides on how to disable SSH Login for the Root User.\" \/>\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.milesweb.co.uk\/hosting-faqs\/disable-ssh-login-for-the-root-user\/\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Disable SSH Login for the Root User - Web Hosting FAQs by MilesWeb\" \/>\n<meta property=\"og:description\" content=\"The article guides on how to disable SSH Login for the Root User.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/disable-ssh-login-for-the-root-user\/\" \/>\n<meta property=\"og:site_name\" content=\"Web Hosting FAQs by MilesWeb\" \/>\n<meta property=\"article:published_time\" content=\"2019-12-11T07:20:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-02-15T08:01:44+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-content\/uploads\/2019\/12\/ssh-login.jpg\" \/>\n<meta name=\"author\" content=\"Sonam Wagh\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Sonam Wagh\" \/>\n\t<meta name=\"twitter:label2\" content=\"Estimated 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\":\"WebPage\",\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/disable-ssh-login-for-the-root-user\/\",\"url\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/disable-ssh-login-for-the-root-user\/\",\"name\":\"Disable SSH Login for the Root User - Web Hosting FAQs by MilesWeb\",\"isPartOf\":{\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/disable-ssh-login-for-the-root-user\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/disable-ssh-login-for-the-root-user\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-content\/uploads\/2019\/12\/ssh-login.jpg\",\"datePublished\":\"2019-12-11T07:20:00+00:00\",\"dateModified\":\"2022-02-15T08:01:44+00:00\",\"author\":{\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#\/schema\/person\/dc645d02823c86e07e53798ebe02c6f4\"},\"description\":\"The article guides on how to disable SSH Login for the Root User.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/disable-ssh-login-for-the-root-user\/#breadcrumb\"},\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/disable-ssh-login-for-the-root-user\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/disable-ssh-login-for-the-root-user\/#primaryimage\",\"url\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-content\/uploads\/2019\/12\/ssh-login.jpg\",\"contentUrl\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-content\/uploads\/2019\/12\/ssh-login.jpg\",\"width\":549,\"height\":148,\"caption\":\"ssh login\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/disable-ssh-login-for-the-root-user\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Disable SSH Login for the Root User\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#website\",\"url\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/\",\"name\":\"Web Hosting FAQs by MilesWeb\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-GB\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#\/schema\/person\/dc645d02823c86e07e53798ebe02c6f4\",\"name\":\"Sonam Wagh\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/9cb2cf6ae11d7625ef6417ef8e84ba25?s=96&d=blank&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/9cb2cf6ae11d7625ef6417ef8e84ba25?s=96&d=blank&r=g\",\"caption\":\"Sonam Wagh\"},\"description\":\"With an interest in doing something creative daily, Sonam works as a Digital Marketing Executive. She likes to write technical blogs related to web hosting, digital marketing, and other IT topics. She also likes to spend her leisure time on social media to find different strategies for client engagement.\",\"url\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/author\/sonam\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Disable SSH Login for the Root User - Web Hosting FAQs by MilesWeb","description":"The article guides on how to disable SSH Login for the Root User.","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.milesweb.co.uk\/hosting-faqs\/disable-ssh-login-for-the-root-user\/","og_locale":"en_GB","og_type":"article","og_title":"Disable SSH Login for the Root User - Web Hosting FAQs by MilesWeb","og_description":"The article guides on how to disable SSH Login for the Root User.","og_url":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/disable-ssh-login-for-the-root-user\/","og_site_name":"Web Hosting FAQs by MilesWeb","article_published_time":"2019-12-11T07:20:00+00:00","article_modified_time":"2022-02-15T08:01:44+00:00","og_image":[{"url":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-content\/uploads\/2019\/12\/ssh-login.jpg","type":"","width":"","height":""}],"author":"Sonam Wagh","twitter_misc":{"Written by":"Sonam Wagh","Estimated reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/disable-ssh-login-for-the-root-user\/","url":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/disable-ssh-login-for-the-root-user\/","name":"Disable SSH Login for the Root User - Web Hosting FAQs by MilesWeb","isPartOf":{"@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/disable-ssh-login-for-the-root-user\/#primaryimage"},"image":{"@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/disable-ssh-login-for-the-root-user\/#primaryimage"},"thumbnailUrl":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-content\/uploads\/2019\/12\/ssh-login.jpg","datePublished":"2019-12-11T07:20:00+00:00","dateModified":"2022-02-15T08:01:44+00:00","author":{"@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#\/schema\/person\/dc645d02823c86e07e53798ebe02c6f4"},"description":"The article guides on how to disable SSH Login for the Root User.","breadcrumb":{"@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/disable-ssh-login-for-the-root-user\/#breadcrumb"},"inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.milesweb.co.uk\/hosting-faqs\/disable-ssh-login-for-the-root-user\/"]}]},{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/disable-ssh-login-for-the-root-user\/#primaryimage","url":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-content\/uploads\/2019\/12\/ssh-login.jpg","contentUrl":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-content\/uploads\/2019\/12\/ssh-login.jpg","width":549,"height":148,"caption":"ssh login"},{"@type":"BreadcrumbList","@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/disable-ssh-login-for-the-root-user\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/"},{"@type":"ListItem","position":2,"name":"Disable SSH Login for the Root User"}]},{"@type":"WebSite","@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#website","url":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/","name":"Web Hosting FAQs by MilesWeb","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-GB"},{"@type":"Person","@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#\/schema\/person\/dc645d02823c86e07e53798ebe02c6f4","name":"Sonam Wagh","image":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/9cb2cf6ae11d7625ef6417ef8e84ba25?s=96&d=blank&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/9cb2cf6ae11d7625ef6417ef8e84ba25?s=96&d=blank&r=g","caption":"Sonam Wagh"},"description":"With an interest in doing something creative daily, Sonam works as a Digital Marketing Executive. She likes to write technical blogs related to web hosting, digital marketing, and other IT topics. She also likes to spend her leisure time on social media to find different strategies for client engagement.","url":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/author\/sonam\/"}]}},"views":460,"_links":{"self":[{"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/posts\/6895","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/users\/18"}],"replies":[{"embeddable":true,"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/comments?post=6895"}],"version-history":[{"count":2,"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/posts\/6895\/revisions"}],"predecessor-version":[{"id":13380,"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/posts\/6895\/revisions\/13380"}],"wp:attachment":[{"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/media?parent=6895"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/categories?post=6895"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/tags?post=6895"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}