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?
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?
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
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 08 '16 at 06:241) 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.
adduser
command will do what you want?
– Dan Dascalescu
Jul 11 '14 at 09:29
Edit the sudoers file: sudo visudo
and add:
user ALL=(ALL:ALL) ALL
/etc/sudoers
when the adduser
command will work?
– Dan Dascalescu
Jul 11 '14 at 09:29
sudo visudo /etc/sudoers
Is it correct? AFAIK, it is either sudo visudo
or sudo nano /etc/sudoers
– d a i s y
Feb 18 '17 at 08:29
visudo
to edit /etc/sudoers
because it stops you from making a fatal syntax error. I corrected
– Zanna
Feb 18 '17 at 08:32
sudo visudo
? – Mitch Jul 26 '12 at 08:19