{"id":4558,"date":"2018-06-27T16:09:21","date_gmt":"2018-06-27T16:09:21","guid":{"rendered":"https:\/\/www.inmotionhosting.com\/support\/2018\/06\/27\/how-to-create-a-sudo-user-in-debian-8\/"},"modified":"2021-10-19T11:18:44","modified_gmt":"2021-10-19T15:18:44","slug":"how-to-create-a-sudo-user-in-debian-8","status":"publish","type":"post","link":"https:\/\/www.inmotionhosting.com\/support\/product-guides\/cloud-server\/how-to-create-a-sudo-user-in-debian-8\/","title":{"rendered":"How to Create a Sudo User in Debian 8"},"content":{"rendered":"\n<p class=\"alert alert-info\">This article refers to an older version of Debian.  Please refer to the full guide on <a href=\"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/sudo-user-debian-10\/\">how to create a sudo user in Debian 10<\/a> if that is the version you are using.<\/p>\n\n\n<p>Your Cloud VPS Hosting account is automatically configured for SSH key authentication. All you need to do is add your public key through your AMP account. This will allow you to log in as the root user. But we recommend creating a unique user account as an alternative to the root user for your every day administrative tasks. In this article, we&#8217;re going to show you how you can <strong>create users<\/strong> on your Debian Cloud VPS. We&#8217;ll also discuss:<\/p>\n<ul>\n<li>Why you should create users as an alternative to using <code>root<\/code><\/li>\n<li>How to create a <em>sudo<\/em> user in Debian<\/li>\n<li>How to log in with an SSH key (by default, passwords are not acceptable)<\/li>\n<\/ul>\n<h2>Why You Should Create Users<\/h2>\n<p>When you first log into your Cloud VPS, you will only be able to assume the root user. As your first action, we recommend creating a unique user for yourself and anyone else who is going to be managing the system with you.<\/p>\n<p>Below, we will walk you through the whole process from creating the user, adding necessary &#8220;sudo&#8221; privileges, and disabling root login over SSH.<\/p>\n<h2>How to Create a New User in Debian<\/h2>\n<p>Below, you will see how to create your Debian user. Make sure to substitute <em>username<\/em> with the username you want to use on your account.<\/p>\n<ol class=\"article_list\">\n<li>Log into your server as the root user, replacing &#8220;example.com&#8221; with your primary domain:\n<pre class=\"cli\">ssh root@example.com<\/pre>\n<\/li>\n<li>Run this command as the root user to create the user account\n<pre class=\"cli\"><span style=\"color: green;\">useradd<\/span> username<\/pre>\n<\/li>\n<li>Fill in a secure password (required) and the extra fields (optional)<\/li>\n<li>To add the new user to the &#8220;sudo&#8221; group, run this command as the root user\n<pre class=\"cli\"><span style=\"color: green;\">usermod -a -G sudo<\/span> username<\/pre>\n<\/li>\n<\/ol>\n<p>We have now created a new user with sudo privileges. However, in order to run root-level commands, you will just need to add the word <em>sudo<\/em> at the beginning of your command line, for example:<\/p>\n<pre class=\"cli\"> <span style=\"color: red;\">sudo<\/span> apt-get update<\/pre>\n<h2>How to Log in with SSH Keys<\/h2>\n<p>Password authentication is automatically disabled for security reasons. This means you must use SSH keys to gain access to your Cloud VPS. We have full guides on how to create SSH keys you can install on your account for the root user, but adding an SSH key for the user we just created requires a few more steps.<\/p>\n<ol class=\"article_list\">\n<li>Switch to new user (still logged in as root from above)\n<pre class=\"cli\">su username<\/pre>\n<\/li>\n<li>Edit the SSH configuration file\n<pre class=\"cli\">sudo nano \/etc\/ssh\/sshd_config<\/pre>\n<\/li>\n<li>Add <em>sudo<\/em> to the line that begins with <em>AllowGroups<\/em>:\n<pre class=\"cli\"><span style=\"color: red;\">- AllowGroups wheel root<\/span><\/pre>\n<pre class=\"cli\"><span style=\"color: green;\">+ AllowGroups wheel root sudo<\/span><\/pre>\n<\/li>\n<li>Add <em>sudo<\/em> to the line that begins with <em>PermitRootLogin<\/em>:\n<pre class=\"cli\"><span style=\"color: red;\">- PermitRootLogin without-password<\/span><\/pre>\n<pre class=\"cli\"><span style=\"color: green;\">+ PermitRootLogin no<\/span><\/pre>\n<\/li>\n<li>Change directory to home\n<pre class=\"cli\">cd<\/pre>\n<\/li>\n<li>Make <span style=\"color: green;\">.ssh<\/span> directory\n<pre class=\"cli\">mkdir .ssh<\/pre>\n<\/li>\n<li>Change into <span style=\"color: green;\">.ssh<\/span> directory and create <span style=\"color: green;\">authorized_keys<\/span> file\n<pre class=\"cli\">nano authorized_keys<\/pre>\n<\/li>\n<li>Paste your public key into the <em>authorized_keys<\/em> file<\/li>\n<li>Change permissions for the <em>.ssh<\/em> directory\n<pre class=\"cli\">chmod 700 ~\/.ssh<\/pre>\n<\/li>\n<li>Change permissions for the <em>authorized_keys<\/em> file\n<pre class=\"cli\">chmod 600 ~\/.ssh\/authorized_keys<\/pre>\n<\/li>\n<\/ol>\n<p>You will now be able to log into Debian with your new user account, and root user logins through SSH are no longer permitted. But, before ending this terminal session, let&#8217;s test out the new user login. Open a new terminal window and test your login with:<\/p>\n<pre class=\"cli\">ssh username@example.com<\/pre>\n<p>If you are logged into your system without a problem then you have successfully created your Debian user account. You can repeat this process as many times as necessary to add other users to your system. Let us know below if you have any questions or comments.<\/p>\n\n\n<p>Learn more from our <a href=\"https:\/\/www.inmotionhosting.com\/support\/product-guides\/cloud-server\/\">Cloud Server Hosting Product Guide<\/a>.<\/p>\n\n\n<div class=\"jumbotron\">\r\n<p>If you don\u2019t need cPanel, don't pay for it. Only pay for what you need with our scalable <a href=\"https:\/\/www.inmotionhosting.com\/cloud-vps\">Cloud VPS Hosting<\/a>.<\/p>\r\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/design.inmotionhosting.com\/assets\/icons\/standard\/check-blue.svg\" alt=\"check mark\" width=\"24\" height=\"24\" \/>CentOS, Debian, or Ubuntu    <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/design.inmotionhosting.com\/assets\/icons\/standard\/check-blue.svg\" alt=\"check mark\" width=\"24\" height=\"24\" \/>No Bloatware    <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/design.inmotionhosting.com\/assets\/icons\/standard\/check-blue.svg\" alt=\"check mark\" width=\"24\" height=\"24\" \/>SSH and Root Access<\/p>\r\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>This article refers to an older version of Debian. Please refer to the full guide on how to create a sudo user in Debian 10 if that is the version you are using. Your Cloud VPS Hosting account is automatically configured for SSH key authentication. All you need to do is add your public key<a class=\"moretag\" href=\"https:\/\/www.inmotionhosting.com\/support\/product-guides\/cloud-server\/how-to-create-a-sudo-user-in-debian-8\/\"> Read More ><\/a><\/p>\n","protected":false},"author":17,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4370],"tags":[],"class_list":["post-4558","post","type-post","status-publish","format-standard","hentry","category-cloud-server"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.1.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to Create a Sudo User in Debian 8 | InMotion Hosting<\/title>\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.inmotionhosting.com\/support\/product-guides\/cloud-server\/how-to-create-a-sudo-user-in-debian-8\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Create a Sudo User in Debian 8 | InMotion Hosting\" \/>\n<meta property=\"og:description\" content=\"This article refers to an older version of Debian. Please refer to the full guide on how to create a sudo user in Debian 10 if that is the version you are using. Your Cloud VPS Hosting account is automatically configured for SSH key authentication. All you need to do is add your public key Read More &gt;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.inmotionhosting.com\/support\/product-guides\/cloud-server\/how-to-create-a-sudo-user-in-debian-8\/\" \/>\n<meta property=\"og:site_name\" content=\"InMotion Hosting Support Center\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/inmotionhosting\/\" \/>\n<meta property=\"article:published_time\" content=\"2018-06-27T16:09:21+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-10-19T15:18:44+00:00\" \/>\n<meta name=\"author\" content=\"Christopher Maiorana\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@InMotionHosting\" \/>\n<meta name=\"twitter:site\" content=\"@InMotionHosting\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Christopher Maiorana\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/product-guides\/cloud-server\/how-to-create-a-sudo-user-in-debian-8\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/product-guides\/cloud-server\/how-to-create-a-sudo-user-in-debian-8\/\"},\"author\":{\"name\":\"Christopher Maiorana\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/c6922c56c84e17079fd558e07b7ef72f\"},\"headline\":\"How to Create a Sudo User in Debian 8\",\"datePublished\":\"2018-06-27T16:09:21+00:00\",\"dateModified\":\"2021-10-19T15:18:44+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/product-guides\/cloud-server\/how-to-create-a-sudo-user-in-debian-8\/\"},\"wordCount\":590,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\"},\"articleSection\":[\"Cloud Server Hosting\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.inmotionhosting.com\/support\/product-guides\/cloud-server\/how-to-create-a-sudo-user-in-debian-8\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/product-guides\/cloud-server\/how-to-create-a-sudo-user-in-debian-8\/\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/product-guides\/cloud-server\/how-to-create-a-sudo-user-in-debian-8\/\",\"name\":\"How to Create a Sudo User in Debian 8 | InMotion Hosting\",\"isPartOf\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#website\"},\"datePublished\":\"2018-06-27T16:09:21+00:00\",\"dateModified\":\"2021-10-19T15:18:44+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/product-guides\/cloud-server\/how-to-create-a-sudo-user-in-debian-8\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.inmotionhosting.com\/support\/product-guides\/cloud-server\/how-to-create-a-sudo-user-in-debian-8\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/product-guides\/cloud-server\/how-to-create-a-sudo-user-in-debian-8\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.inmotionhosting.com\/support\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Create a Sudo User in Debian 8\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#website\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/\",\"name\":\"InMotion Hosting Support Center\",\"description\":\"Web Hosting Support &amp; Tutorials\",\"publisher\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.inmotionhosting.com\/support\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\",\"name\":\"InMotion Hosting\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg\",\"contentUrl\":\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg\",\"width\":696,\"height\":696,\"caption\":\"InMotion Hosting\"},\"image\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/inmotionhosting\/\",\"https:\/\/x.com\/InMotionHosting\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/c6922c56c84e17079fd558e07b7ef72f\",\"name\":\"Christopher Maiorana\",\"description\":\"Christopher Maiorana joined the InMotion community team in 2015 and regularly dispenses tips and tricks in the Support Center, Community Q&A, and the InMotion Hosting Blog.\",\"sameAs\":[\"https:\/\/www.linkedin.com\/in\/chris-m-4623144b\/\"],\"url\":\"https:\/\/www.inmotionhosting.com\/support\/author\/christopherm\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Create a Sudo User in Debian 8 | InMotion Hosting","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.inmotionhosting.com\/support\/product-guides\/cloud-server\/how-to-create-a-sudo-user-in-debian-8\/","og_locale":"en_US","og_type":"article","og_title":"How to Create a Sudo User in Debian 8 | InMotion Hosting","og_description":"This article refers to an older version of Debian. Please refer to the full guide on how to create a sudo user in Debian 10 if that is the version you are using. Your Cloud VPS Hosting account is automatically configured for SSH key authentication. All you need to do is add your public key Read More >","og_url":"https:\/\/www.inmotionhosting.com\/support\/product-guides\/cloud-server\/how-to-create-a-sudo-user-in-debian-8\/","og_site_name":"InMotion Hosting Support Center","article_publisher":"https:\/\/www.facebook.com\/inmotionhosting\/","article_published_time":"2018-06-27T16:09:21+00:00","article_modified_time":"2021-10-19T15:18:44+00:00","author":"Christopher Maiorana","twitter_card":"summary_large_image","twitter_creator":"@InMotionHosting","twitter_site":"@InMotionHosting","twitter_misc":{"Written by":"Christopher Maiorana","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.inmotionhosting.com\/support\/product-guides\/cloud-server\/how-to-create-a-sudo-user-in-debian-8\/#article","isPartOf":{"@id":"https:\/\/www.inmotionhosting.com\/support\/product-guides\/cloud-server\/how-to-create-a-sudo-user-in-debian-8\/"},"author":{"name":"Christopher Maiorana","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/c6922c56c84e17079fd558e07b7ef72f"},"headline":"How to Create a Sudo User in Debian 8","datePublished":"2018-06-27T16:09:21+00:00","dateModified":"2021-10-19T15:18:44+00:00","mainEntityOfPage":{"@id":"https:\/\/www.inmotionhosting.com\/support\/product-guides\/cloud-server\/how-to-create-a-sudo-user-in-debian-8\/"},"wordCount":590,"commentCount":0,"publisher":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#organization"},"articleSection":["Cloud Server Hosting"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.inmotionhosting.com\/support\/product-guides\/cloud-server\/how-to-create-a-sudo-user-in-debian-8\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.inmotionhosting.com\/support\/product-guides\/cloud-server\/how-to-create-a-sudo-user-in-debian-8\/","url":"https:\/\/www.inmotionhosting.com\/support\/product-guides\/cloud-server\/how-to-create-a-sudo-user-in-debian-8\/","name":"How to Create a Sudo User in Debian 8 | InMotion Hosting","isPartOf":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#website"},"datePublished":"2018-06-27T16:09:21+00:00","dateModified":"2021-10-19T15:18:44+00:00","breadcrumb":{"@id":"https:\/\/www.inmotionhosting.com\/support\/product-guides\/cloud-server\/how-to-create-a-sudo-user-in-debian-8\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.inmotionhosting.com\/support\/product-guides\/cloud-server\/how-to-create-a-sudo-user-in-debian-8\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.inmotionhosting.com\/support\/product-guides\/cloud-server\/how-to-create-a-sudo-user-in-debian-8\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.inmotionhosting.com\/support\/"},{"@type":"ListItem","position":2,"name":"How to Create a Sudo User in Debian 8"}]},{"@type":"WebSite","@id":"https:\/\/www.inmotionhosting.com\/support\/#website","url":"https:\/\/www.inmotionhosting.com\/support\/","name":"InMotion Hosting Support Center","description":"Web Hosting Support &amp; Tutorials","publisher":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.inmotionhosting.com\/support\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.inmotionhosting.com\/support\/#organization","name":"InMotion Hosting","url":"https:\/\/www.inmotionhosting.com\/support\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/","url":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg","contentUrl":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg","width":696,"height":696,"caption":"InMotion Hosting"},"image":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/inmotionhosting\/","https:\/\/x.com\/InMotionHosting"]},{"@type":"Person","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/c6922c56c84e17079fd558e07b7ef72f","name":"Christopher Maiorana","description":"Christopher Maiorana joined the InMotion community team in 2015 and regularly dispenses tips and tricks in the Support Center, Community Q&A, and the InMotion Hosting Blog.","sameAs":["https:\/\/www.linkedin.com\/in\/chris-m-4623144b\/"],"url":"https:\/\/www.inmotionhosting.com\/support\/author\/christopherm\/"}]}},"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"primary_category":null,"_links":{"self":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/4558","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/users\/17"}],"replies":[{"embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/comments?post=4558"}],"version-history":[{"count":4,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/4558\/revisions"}],"predecessor-version":[{"id":89980,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/4558\/revisions\/89980"}],"wp:attachment":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/media?parent=4558"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/categories?post=4558"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/tags?post=4558"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}