{"id":31,"date":"2018-09-11T12:56:38","date_gmt":"2018-09-11T12:56:38","guid":{"rendered":"https:\/\/purepcs.co.uk\/kb\/?p=31"},"modified":"2018-09-11T13:09:24","modified_gmt":"2018-09-11T13:09:24","slug":"add-user-to-sudo-centos-7","status":"publish","type":"post","link":"https:\/\/purepcs.co.uk\/kb\/add-user-to-sudo-centos-7\/","title":{"rendered":"Add user to sudo &#8211; CentOS 7"},"content":{"rendered":"<p>Enabling users to sudo in CentOS 7.\u00a0 This post assumes you need to create a new user for the task AND that the <em>wheel<\/em> group is enabled in the <em>\/etc\/sudoers<\/em> file.<\/p>\n<p>Somehow, you&#8217;ll end up a the CLi, be that an SSH client, via Terminal at the GUI directly on the box, using your mobile device or whatever floats your particular boat. Remember to replace USERNAME with the actual username you want to use.<\/p>\n<p>First up, add the user<\/p>\n<pre>useradd USERNAME<\/pre>\n<p>And then set the password.<\/p>\n<pre>passwd USERNAME<\/pre>\n<p>You&#8217;ll need to set the password and confirm it here, look out for any warnings or errors&#8230;<\/p>\n<p>Now we can add the user to the <em>wheel<\/em> group<\/p>\n<pre>usermod -aG wheel USERNAME<\/pre>\n<p>And that that.\u00a0 Open a new session, login as the new user and try someting like<\/p>\n<pre>cat \/etc\/sudoers<\/pre>\n<p>and you should see.<\/p>\n<pre>cat: \/etc\/sudoers: Permission denied<\/pre>\n<p>Change the command to be<\/p>\n<pre>sudo cat \/etc\/sudoers<\/pre>\n<p>You should then be prompted for your sudo password (login password) and be granted access to view the file, or run any other root command you require.<\/p>\n<p>You may find that the wheel group is ot enabled in the sudoers file.\u00a0 if so, as a root user open the file for editing (I prefer nano, use whatever you like)<\/p>\n<pre>nano \/etc\/sudoers<\/pre>\n<p>and find the following line.<\/p>\n<pre>#%wheel ALL=(ALL) ALL<\/pre>\n<p>remove the preceding <em># <\/em>so the line reads.<\/p>\n<pre>%wheel ALL=(ALL) ALL<\/pre>\n<p>Use CTRL+O to save the file and CTRL+X to exit the editor (in nano), then try to sudo as the new user in a new session.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Enabling users to sudo in CentOS 7.\u00a0 This post assumes you need to create a new user for the task AND that the wheel group<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[14,13],"tags":[22,20,21],"class_list":["post-31","post","type-post","status-publish","format-standard","hentry","category-command-line-cli","category-linux","tag-root","tag-sudo","tag-wheel"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Add user to sudo - CentOS 7 - Pure PC&#039;s<\/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:\/\/purepcs.co.uk\/kb\/add-user-to-sudo-centos-7\/\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Add user to sudo - CentOS 7 - Pure PC&#039;s\" \/>\n<meta property=\"og:description\" content=\"Enabling users to sudo in CentOS 7.\u00a0 This post assumes you need to create a new user for the task AND that the wheel group\" \/>\n<meta property=\"og:url\" content=\"https:\/\/purepcs.co.uk\/kb\/add-user-to-sudo-centos-7\/\" \/>\n<meta property=\"og:site_name\" content=\"Pure PC&#039;s\" \/>\n<meta property=\"article:published_time\" content=\"2018-09-11T12:56:38+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2018-09-11T13:09:24+00:00\" \/>\n<meta name=\"author\" content=\"purepcs\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"purepcs\" \/>\n\t<meta name=\"twitter:label2\" content=\"Estimated reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/purepcs.co.uk\/kb\/add-user-to-sudo-centos-7\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/purepcs.co.uk\/kb\/add-user-to-sudo-centos-7\/\"},\"author\":{\"name\":\"purepcs\",\"@id\":\"https:\/\/purepcs.co.uk\/kb\/#\/schema\/person\/d93eda5f74d1012b66a00b4518a0b089\"},\"headline\":\"Add user to sudo &#8211; CentOS 7\",\"datePublished\":\"2018-09-11T12:56:38+00:00\",\"dateModified\":\"2018-09-11T13:09:24+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/purepcs.co.uk\/kb\/add-user-to-sudo-centos-7\/\"},\"wordCount\":241,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/purepcs.co.uk\/kb\/#\/schema\/person\/d93eda5f74d1012b66a00b4518a0b089\"},\"keywords\":[\"root\",\"sudo\",\"wheel\"],\"articleSection\":[\"Command Line (CLi)\",\"Linux\"],\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/purepcs.co.uk\/kb\/add-user-to-sudo-centos-7\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/purepcs.co.uk\/kb\/add-user-to-sudo-centos-7\/\",\"url\":\"https:\/\/purepcs.co.uk\/kb\/add-user-to-sudo-centos-7\/\",\"name\":\"Add user to sudo - CentOS 7 - Pure PC&#039;s\",\"isPartOf\":{\"@id\":\"https:\/\/purepcs.co.uk\/kb\/#website\"},\"datePublished\":\"2018-09-11T12:56:38+00:00\",\"dateModified\":\"2018-09-11T13:09:24+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/purepcs.co.uk\/kb\/add-user-to-sudo-centos-7\/#breadcrumb\"},\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/purepcs.co.uk\/kb\/add-user-to-sudo-centos-7\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/purepcs.co.uk\/kb\/add-user-to-sudo-centos-7\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/purepcs.co.uk\/kb\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Add user to sudo &#8211; CentOS 7\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/purepcs.co.uk\/kb\/#website\",\"url\":\"https:\/\/purepcs.co.uk\/kb\/\",\"name\":\"Pure PC&#039;s\",\"description\":\"Ramblings, Knowledge and Musings\",\"publisher\":{\"@id\":\"https:\/\/purepcs.co.uk\/kb\/#\/schema\/person\/d93eda5f74d1012b66a00b4518a0b089\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/purepcs.co.uk\/kb\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-GB\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/purepcs.co.uk\/kb\/#\/schema\/person\/d93eda5f74d1012b66a00b4518a0b089\",\"name\":\"purepcs\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\/\/purepcs.co.uk\/kb\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/05a7ed7212adca9fab9199df1a61e3092c4eaf22b6e66ab39599144a212ea6f2?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/05a7ed7212adca9fab9199df1a61e3092c4eaf22b6e66ab39599144a212ea6f2?s=96&d=mm&r=g\",\"caption\":\"purepcs\"},\"logo\":{\"@id\":\"https:\/\/purepcs.co.uk\/kb\/#\/schema\/person\/image\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Add user to sudo - CentOS 7 - Pure PC&#039;s","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:\/\/purepcs.co.uk\/kb\/add-user-to-sudo-centos-7\/","og_locale":"en_GB","og_type":"article","og_title":"Add user to sudo - CentOS 7 - Pure PC&#039;s","og_description":"Enabling users to sudo in CentOS 7.\u00a0 This post assumes you need to create a new user for the task AND that the wheel group","og_url":"https:\/\/purepcs.co.uk\/kb\/add-user-to-sudo-centos-7\/","og_site_name":"Pure PC&#039;s","article_published_time":"2018-09-11T12:56:38+00:00","article_modified_time":"2018-09-11T13:09:24+00:00","author":"purepcs","twitter_card":"summary_large_image","twitter_misc":{"Written by":"purepcs","Estimated reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/purepcs.co.uk\/kb\/add-user-to-sudo-centos-7\/#article","isPartOf":{"@id":"https:\/\/purepcs.co.uk\/kb\/add-user-to-sudo-centos-7\/"},"author":{"name":"purepcs","@id":"https:\/\/purepcs.co.uk\/kb\/#\/schema\/person\/d93eda5f74d1012b66a00b4518a0b089"},"headline":"Add user to sudo &#8211; CentOS 7","datePublished":"2018-09-11T12:56:38+00:00","dateModified":"2018-09-11T13:09:24+00:00","mainEntityOfPage":{"@id":"https:\/\/purepcs.co.uk\/kb\/add-user-to-sudo-centos-7\/"},"wordCount":241,"commentCount":0,"publisher":{"@id":"https:\/\/purepcs.co.uk\/kb\/#\/schema\/person\/d93eda5f74d1012b66a00b4518a0b089"},"keywords":["root","sudo","wheel"],"articleSection":["Command Line (CLi)","Linux"],"inLanguage":"en-GB","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/purepcs.co.uk\/kb\/add-user-to-sudo-centos-7\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/purepcs.co.uk\/kb\/add-user-to-sudo-centos-7\/","url":"https:\/\/purepcs.co.uk\/kb\/add-user-to-sudo-centos-7\/","name":"Add user to sudo - CentOS 7 - Pure PC&#039;s","isPartOf":{"@id":"https:\/\/purepcs.co.uk\/kb\/#website"},"datePublished":"2018-09-11T12:56:38+00:00","dateModified":"2018-09-11T13:09:24+00:00","breadcrumb":{"@id":"https:\/\/purepcs.co.uk\/kb\/add-user-to-sudo-centos-7\/#breadcrumb"},"inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["https:\/\/purepcs.co.uk\/kb\/add-user-to-sudo-centos-7\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/purepcs.co.uk\/kb\/add-user-to-sudo-centos-7\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/purepcs.co.uk\/kb\/"},{"@type":"ListItem","position":2,"name":"Add user to sudo &#8211; CentOS 7"}]},{"@type":"WebSite","@id":"https:\/\/purepcs.co.uk\/kb\/#website","url":"https:\/\/purepcs.co.uk\/kb\/","name":"Pure PC&#039;s","description":"Ramblings, Knowledge and Musings","publisher":{"@id":"https:\/\/purepcs.co.uk\/kb\/#\/schema\/person\/d93eda5f74d1012b66a00b4518a0b089"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/purepcs.co.uk\/kb\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-GB"},{"@type":["Person","Organization"],"@id":"https:\/\/purepcs.co.uk\/kb\/#\/schema\/person\/d93eda5f74d1012b66a00b4518a0b089","name":"purepcs","image":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/purepcs.co.uk\/kb\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/05a7ed7212adca9fab9199df1a61e3092c4eaf22b6e66ab39599144a212ea6f2?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/05a7ed7212adca9fab9199df1a61e3092c4eaf22b6e66ab39599144a212ea6f2?s=96&d=mm&r=g","caption":"purepcs"},"logo":{"@id":"https:\/\/purepcs.co.uk\/kb\/#\/schema\/person\/image\/"}}]}},"_links":{"self":[{"href":"https:\/\/purepcs.co.uk\/kb\/wp-json\/wp\/v2\/posts\/31","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/purepcs.co.uk\/kb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/purepcs.co.uk\/kb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/purepcs.co.uk\/kb\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/purepcs.co.uk\/kb\/wp-json\/wp\/v2\/comments?post=31"}],"version-history":[{"count":3,"href":"https:\/\/purepcs.co.uk\/kb\/wp-json\/wp\/v2\/posts\/31\/revisions"}],"predecessor-version":[{"id":34,"href":"https:\/\/purepcs.co.uk\/kb\/wp-json\/wp\/v2\/posts\/31\/revisions\/34"}],"wp:attachment":[{"href":"https:\/\/purepcs.co.uk\/kb\/wp-json\/wp\/v2\/media?parent=31"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/purepcs.co.uk\/kb\/wp-json\/wp\/v2\/categories?post=31"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/purepcs.co.uk\/kb\/wp-json\/wp\/v2\/tags?post=31"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}