Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
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
up vote 118 down vote accepted

You need to add the user hduser 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
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
not working ubuntu 14 – Ashish Ratan Jan 8 at 6:23
Usage: usermod [options] LOGIN Options: -c, --comment COMMENT new value of the GECOS field -d, --home HOME_DIR new home directory for the user account -e, --expiredate EXPIRE_DATE set account expiration date to EXPIRE_DATE -f, --inactive INACTIVE set password inactive after expiration to INACTIVE -g, --gid GROUP force use GROUP as new primary group -G, --groups GROUPS new list of supplementary GROUPS -a, --append append the user to the supplemental GROUPS – Ashish Ratan Jan 8 at 6:24
No problem here using ubuntu 14. Thx. – joedragons Jan 26 at 20:09

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 
ics ALL=(ALL) ALL 
csm ALL=(ALL) ALL 

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

share|improve this answer
This seems needlessly complicated. Why bother running visudo when the adduser command will do what you want? – Dan Dascalescu Jul 11 '14 at 9:29
@dan-dascalescu - $ sudo adduser username sudo won't work if the 'sudo' group does not exist. So adding the user manually is certainly an option. However, it's certainly more elegant to create a sudo group, add it to the sudoers file (e.g. via visudo), then add the appropriate user(s) to that user group. – Jarrett Barnett Oct 2 '15 at 17:47
@JarrettBarnett That was the case for me. Thank you for your answer. – Marcel Mar 21 at 22:47

edit nano /etc/sudoers

and add:

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

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