Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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
share|improve this question

1 Answer 1

up vote 7 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.

share|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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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