{"id":97,"date":"2021-06-11T03:34:23","date_gmt":"2021-06-11T03:34:23","guid":{"rendered":"https:\/\/sfcompy.com\/blog\/?p=97"},"modified":"2021-06-26T14:05:38","modified_gmt":"2021-06-26T21:05:38","slug":"create-a-sudo-user-macos-cli","status":"publish","type":"post","link":"https:\/\/sfcompy.com\/blog\/create-a-sudo-user-macos-cli\/","title":{"rendered":"Create a Sudo User &#8211; MacOS CLI"},"content":{"rendered":"\n<p>This is an example that shows how to create a Sudo user, means a Standard user with an Admin privileges, with this capabilities you will be able to perform some system changes and install software at system level(root level) from your a standard user account without the need to switch to an Admin user account , changes with privileges that only belong to Administrator users. So keep in mind!, on a regular daily work base , you should never work and login as a user with Administrator\\sudo power and privileges, and if you are not sure what you are doing and you must using this command at the terminal to make some system changes or to install some software or library, after you complete the task, make sure that you close all the Sudo process and to exit form Sudo user by typing &#8216;exit&#8217;  command at  the terminal and close the terminal window (to  avoid further confusions)<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">1). Log in to admin user\n\n2). Open a terminal\n\n3). Edit the file 'sudoers' located at \\etc folder\n\n<span class=\"has-inline-color has-vivid-green-cyan-color\">bash&gt; nano \/etc\/sudoers<\/span>\n\n4). Scroll down and find the line with&nbsp;\n .\n .\n # root and users in group wheel can run anything on any machine as any user\n root ALL = (ALL) ALL&nbsp;\n .\n .\n\n5). Under line that begin with the 'root' add the user (ex: myuser) that you want it to be with the sudo privileges,  write it with the same format as the line with the root... end-up to have:\n .\n .\n # root and users in group wheel can run anything on any machine as any user\n root&nbsp; ALL = (ALL) ALL\n <span class=\"has-inline-color has-vivid-green-cyan-color\">myuser ALL = (ALL) ALL<\/span>\n .\n .\n\n6). Save and exit the editor&nbsp;\n\n7). Logout from the Admin account and login to the new sudo user account (myuser)\n\n8). To check if the sudo works, try to see the content of the suders file type:&nbsp;\n\n<span class=\"has-inline-color has-vivid-green-cyan-color\">bash&gt; cat \/etc\/sudoers<\/span>\n\nthis will reject the request and print a denied message\ncat: \/etc\/sudoers: Permission denied'\n\n9). now try to run this line again but this time with the sudo command at the beginning :&nbsp;\n\nbash&gt; sudo cat \/etc\/sudoers\nif the sudo is working, it will output the content of the suders file and you will see the line with the user name that you just added\n .\n .\n <span class=\"has-inline-color has-vivid-green-cyan-color\">myuser ALL = (ALL) ALL<\/span>\n .\n .\n \nDONE! <\/pre>\n","protected":false},"excerpt":{"rendered":"<p>This is an example that shows how to create a Sudo user, means a Standard user with an Admin privileges, with this capabilities you will be able to perform some system changes and install software at system level(root level) from your a standard user account without the need to switch to an Admin user account&#8230;<\/p>\n<p class=\"more-link-wrap\"><a href=\"https:\/\/sfcompy.com\/blog\/create-a-sudo-user-macos-cli\/\" class=\"more-link\">Read More<span class=\"screen-reader-text\"> &ldquo;Create a Sudo User &#8211; MacOS CLI&rdquo;<\/span> &raquo;<\/a><\/p>\n","protected":false},"author":2,"featured_media":111,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[61,51],"tags":[73,79,81,82,80,29],"_links":{"self":[{"href":"https:\/\/sfcompy.com\/blog\/wp-json\/wp\/v2\/posts\/97"}],"collection":[{"href":"https:\/\/sfcompy.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sfcompy.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sfcompy.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/sfcompy.com\/blog\/wp-json\/wp\/v2\/comments?post=97"}],"version-history":[{"count":0,"href":"https:\/\/sfcompy.com\/blog\/wp-json\/wp\/v2\/posts\/97\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/sfcompy.com\/blog\/wp-json\/wp\/v2\/media\/111"}],"wp:attachment":[{"href":"https:\/\/sfcompy.com\/blog\/wp-json\/wp\/v2\/media?parent=97"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sfcompy.com\/blog\/wp-json\/wp\/v2\/categories?post=97"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sfcompy.com\/blog\/wp-json\/wp\/v2\/tags?post=97"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}