{"id":2119,"date":"2016-06-28T16:39:02","date_gmt":"2016-06-28T20:39:02","guid":{"rendered":"https:\/\/www.globo.tech\/learning-center\/?p=2119"},"modified":"2017-12-12T16:00:23","modified_gmt":"2017-12-12T21:00:23","slug":"create-sudo-user-centos-7","status":"publish","type":"post","link":"https:\/\/www.globo.tech\/learning-center\/create-sudo-user-centos-7\/","title":{"rendered":"How To Create a Sudo User on CentOS 7"},"content":{"rendered":"<h1>How To Create a Sudo User on CentOS 7<\/h1>\n<p>If you&#8217;re manually provisioning a server, you should never connect directly as root. Rather, you should create separate users with sudo capabilities, always accessing the server as the non-root user and running root commands with sudo. This setup has several key advantages. First, users can be limited on what commands they run, or what actions are taken when root. You can also audit actions, as well as easily revoke root access without rotating keys or changing a root password to which everyone has access.<\/p>\n<h2>Getting Started<\/h2>\n<p>To complete this guide, you will need the following:<br \/>\n\u2022 1 Node (<a href=\"https:\/\/www.globo.tech\/cloud-server-pricing\" target=\"_blank\">Cloud Server<\/a> or <a href=\"http:\/\/www.globo.tech\/dedicated-server-hosting\" target=\"_blank\">Dedicated Server<\/a>) with a clean CentOS 7 installed. <\/p>\n<p>When finished, you&#8217;ll have a regular user who can elevate privileges to root.<\/p>\n<h2>Tutorial<\/h2>\n<p>We&#8217;ll begin by creating a normal user. In this case, the user is named &#8220;globotech.&#8221;<\/p>\n<p><code>adduser globotech<\/code><\/p>\n<p>Set the user&#8217;s password so it can connect and authenticate.<\/p>\n<p><code>passwd globotech<\/code><\/p>\n<p>By default, all members of the &#8220;wheel&#8221; group get sudo privileges. This enables group members to run commands as the root user. Let&#8217;s add our user to this group.<\/p>\n<p><code>usermod -aG wheel globotech<\/code><\/p>\n<p>The content of \/root is normally not visible to regular users. To test out our setup, let&#8217;s connect as globotech.<\/p>\n<p><code>su -l globotech<\/code><\/p>\n<p>Next, use the sudo command to gain root privileges. Sudo accepts another command that is run as root. In this case, we run the command to list the \/root directory, but do so as the root user. You&#8217;ll be prompted for a password, which should be the globotech password you set up previously.<\/p>\n<p><code>sudo ls \/root<\/code><\/p>\n<p>You can now log in as globotech and run any command as root. Just remember to prepend &#8220;sudo&#8221; to any command you wish to run with administrative privileges.<\/p>\n<h2>Conclusion<\/h2>\n<p>You now have a secure system which lets individual users gain administrative privileges. While this example lets users run specific commands, it is also possible to limit access to certain command types. You might, for instance, let some users run all commands, others only manipulate files, and still others install and remove packages. With sudo, you can create arbitrarily rich administrative access control lists for any use case you can imagine. If this guide was helpful to you, kindly share it with others who may also be interested. <\/p>\n<!-- AddThis Advanced Settings generic via filter on the_content --><!-- AddThis Share Buttons generic via filter on the_content -->","protected":false},"excerpt":{"rendered":"<p>How To Create a Sudo User on CentOS 7 If you&#8217;re manually provisioning a server, you should never connect directly as root. Rather, you should create separate users with sudo capabilities, always accessing the server as the non-root user and running root commands with sudo. This setup has several key advantages. First, users can be<!-- AddThis Advanced Settings generic via filter on get_the_excerpt --><!-- AddThis Share Buttons generic via filter on get_the_excerpt --><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[73],"tags":[],"class_list":["post-2119","post","type-post","status-publish","format-standard","hentry","category-security","operating_system-centos-7"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How To Create a Sudo User on CentOS 7 - Globo.Tech<\/title>\n<meta name=\"description\" content=\"This tutorial will show you how create a Sudo User on your CentOS 7 Server. Read Now &amp; Start manually provisioning your server!\" \/>\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.globo.tech\/learning-center\/create-sudo-user-centos-7\/\" \/>\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 on CentOS 7 - Globo.Tech\" \/>\n<meta property=\"og:description\" content=\"This tutorial will show you how create a Sudo User on your CentOS 7 Server. Read Now &amp; Start manually provisioning your server!\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.globo.tech\/learning-center\/create-sudo-user-centos-7\/\" \/>\n<meta property=\"og:site_name\" content=\"Globo.Tech\" \/>\n<meta property=\"article:published_time\" content=\"2016-06-28T20:39:02+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2017-12-12T21:00:23+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.globo.tech\/learning-center\/wp-content\/uploads\/2016\/09\/GloboTech-Logo.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1920\" \/>\n\t<meta property=\"og:image:height\" content=\"963\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"GloboTech Communications\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"GloboTech Communications\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. 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\":\"Article\",\"@id\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/create-sudo-user-centos-7\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/create-sudo-user-centos-7\\\/\"},\"author\":{\"name\":\"GloboTech Communications\",\"@id\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/#\\\/schema\\\/person\\\/e17784b37f4a4f49b7bc611847912e87\"},\"headline\":\"How To Create a Sudo User on CentOS 7\",\"datePublished\":\"2016-06-28T20:39:02+00:00\",\"dateModified\":\"2017-12-12T21:00:23+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/create-sudo-user-centos-7\\\/\"},\"wordCount\":387,\"commentCount\":0,\"articleSection\":[\"Security\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/create-sudo-user-centos-7\\\/\",\"url\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/create-sudo-user-centos-7\\\/\",\"name\":\"How To Create a Sudo User on CentOS 7 - Globo.Tech\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/#website\"},\"datePublished\":\"2016-06-28T20:39:02+00:00\",\"dateModified\":\"2017-12-12T21:00:23+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/#\\\/schema\\\/person\\\/e17784b37f4a4f49b7bc611847912e87\"},\"description\":\"This tutorial will show you how create a Sudo User on your CentOS 7 Server. Read Now & Start manually provisioning your server!\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/create-sudo-user-centos-7\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/create-sudo-user-centos-7\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/create-sudo-user-centos-7\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How To Create a Sudo User on CentOS 7\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/#website\",\"url\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/\",\"name\":\"Globo.Tech\",\"description\":\"Welcome to the Official Globo.Tech Learning Center\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/#\\\/schema\\\/person\\\/e17784b37f4a4f49b7bc611847912e87\",\"name\":\"GloboTech Communications\",\"sameAs\":[\"http:\\\/\\\/www.gtcomm.net\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How To Create a Sudo User on CentOS 7 - Globo.Tech","description":"This tutorial will show you how create a Sudo User on your CentOS 7 Server. Read Now & Start manually provisioning your server!","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.globo.tech\/learning-center\/create-sudo-user-centos-7\/","og_locale":"en_US","og_type":"article","og_title":"How To Create a Sudo User on CentOS 7 - Globo.Tech","og_description":"This tutorial will show you how create a Sudo User on your CentOS 7 Server. Read Now & Start manually provisioning your server!","og_url":"https:\/\/www.globo.tech\/learning-center\/create-sudo-user-centos-7\/","og_site_name":"Globo.Tech","article_published_time":"2016-06-28T20:39:02+00:00","article_modified_time":"2017-12-12T21:00:23+00:00","og_image":[{"width":1920,"height":963,"url":"https:\/\/www.globo.tech\/learning-center\/wp-content\/uploads\/2016\/09\/GloboTech-Logo.png","type":"image\/png"}],"author":"GloboTech Communications","twitter_misc":{"Written by":"GloboTech Communications","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.globo.tech\/learning-center\/create-sudo-user-centos-7\/#article","isPartOf":{"@id":"https:\/\/www.globo.tech\/learning-center\/create-sudo-user-centos-7\/"},"author":{"name":"GloboTech Communications","@id":"https:\/\/www.globo.tech\/learning-center\/#\/schema\/person\/e17784b37f4a4f49b7bc611847912e87"},"headline":"How To Create a Sudo User on CentOS 7","datePublished":"2016-06-28T20:39:02+00:00","dateModified":"2017-12-12T21:00:23+00:00","mainEntityOfPage":{"@id":"https:\/\/www.globo.tech\/learning-center\/create-sudo-user-centos-7\/"},"wordCount":387,"commentCount":0,"articleSection":["Security"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.globo.tech\/learning-center\/create-sudo-user-centos-7\/","url":"https:\/\/www.globo.tech\/learning-center\/create-sudo-user-centos-7\/","name":"How To Create a Sudo User on CentOS 7 - Globo.Tech","isPartOf":{"@id":"https:\/\/www.globo.tech\/learning-center\/#website"},"datePublished":"2016-06-28T20:39:02+00:00","dateModified":"2017-12-12T21:00:23+00:00","author":{"@id":"https:\/\/www.globo.tech\/learning-center\/#\/schema\/person\/e17784b37f4a4f49b7bc611847912e87"},"description":"This tutorial will show you how create a Sudo User on your CentOS 7 Server. Read Now & Start manually provisioning your server!","breadcrumb":{"@id":"https:\/\/www.globo.tech\/learning-center\/create-sudo-user-centos-7\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.globo.tech\/learning-center\/create-sudo-user-centos-7\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.globo.tech\/learning-center\/create-sudo-user-centos-7\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.globo.tech\/learning-center\/"},{"@type":"ListItem","position":2,"name":"How To Create a Sudo User on CentOS 7"}]},{"@type":"WebSite","@id":"https:\/\/www.globo.tech\/learning-center\/#website","url":"https:\/\/www.globo.tech\/learning-center\/","name":"Globo.Tech","description":"Welcome to the Official Globo.Tech Learning Center","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.globo.tech\/learning-center\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.globo.tech\/learning-center\/#\/schema\/person\/e17784b37f4a4f49b7bc611847912e87","name":"GloboTech Communications","sameAs":["http:\/\/www.gtcomm.net"]}]}},"_links":{"self":[{"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/posts\/2119","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/comments?post=2119"}],"version-history":[{"count":4,"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/posts\/2119\/revisions"}],"predecessor-version":[{"id":4011,"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/posts\/2119\/revisions\/4011"}],"wp:attachment":[{"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/media?parent=2119"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/categories?post=2119"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/tags?post=2119"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}