Hi I'm trying to add myuser to sudoers after a fresh install with root account,

# adduser myuser admin 

which gives:

adduser: the group `admin' does not exist.

however this works:

# adduser myuser root

but it doesn't make myuser a sudoer.

Furthermore, /etc/sudoers does contain these lines:

# User privilege specification
root    ALL=(ALL:ALL) ALL

# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL

but pretty strange -- the file /etc/group doesn't contain admin.

Should I just manually edit it and add something like:

admin:x:120:myuser
link|improve this question

feedback

1 Answer

up vote 2 down vote accepted

use groupadd admin to add the group then you could run adduser myuser admin. However you may want to instead use usermod -G myuser,admin myuser to remove yourself from the root group. (instead of myuser,admin, list the exact list of groups your user should be a member of.

If you ever get tempted to edit /etc/group directly, please use the vigr command, which will make sure the syntax of the file is correct before committing changes.

link|improve this answer
Thanks @stew! worked like a magic! one thing i had to do is to logout and then login with myuser. – valk Dec 16 '11 at 19:42
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.