Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

This question already has an answer here:

I want to grant a newly created user sudo privileges in Ubuntu.

I tried

sudo adduser hduser admin

but it says no admin group exists. How can I do it?

share|improve this question

marked as duplicate by Florian Diesch, Seth, chaskes, Eric Carvalho, Warren Hill Nov 22 '13 at 13:35

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
What is the output of sudo visudo? –  Mitch Jul 26 '12 at 8:19
1  
This was changed recently, which is the reason for the confusion. –  Adrian Jul 26 '12 at 8:29
    
sudo adduser <username> sudo - did the trick for me. Second sudo is the group name instead of sudo –  Jamess Sep 21 '12 at 12:28

4 Answers 4

up vote 51 down vote accepted

You need to add the user to the sudo group (which is the "administrators" group in Ubuntu).

If you have already created the user, you can add the user to the sudo group by running the following command in a Terminal.

sudo usermod -a -G sudo hduser
share|improve this answer
8  
Note that the user must log off, then back on again for this change to take effect. –  Jacob Foshee Jul 5 '13 at 16:01

Instead you can try,

sudo adduser hduser sudo

Because In some linux distributions, there is no group called admin in unix. You need to add the user only to the group sudo.

share|improve this answer

1) Become root. You can do this using sudo -i or becoming root the old fashioned way su -

2) Run visudo

3) I changed this portion of the sudoers file to have my chosen users become sudo users, and you can add users similarly (blank lines introduce to format cleanly):

## User Aliases
## These aren't often necessary, as you can use regular groups
## (ie, from files, LDAP, NIS, etc) in this file - just use %groupname
## rather than USERALIAS
# User_Alias ADMINS = jsmith, mikem dbadmin 
ALL=(ALL) ALL
ics ALL=(ALL) ALL 
csm ALL=(ALL) ALL 
coa ALL=(ALL) ALL

4) Press : and x to write the changes to sudoers and exit vi.

share|improve this answer
1  
This seems needlessly complicated. Why bother running visudo when the adduser command will do what you want? –  Dan Dascalescu Jul 11 at 9:29

edit nano /etc/sudoers

and add:

user    ALL=(ALL:ALL) ALL
share|improve this answer
2  
Why bother editing /etc/sudoers when the adduser command will work? –  Dan Dascalescu Jul 11 at 9:29

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