Add a new user account with admin access on Linux

Originally published at: https://www.cyberciti.biz/faq/add-new-user-account-with-admin-access-on-linux/

How do I add a user account with admin (sudo) access on Ubuntu or CentOS Linux cloud server? How can I add a new user with admin account level access in Linux?

wheel for Ubuntu/Debian ? You say in https://www.cyberciti.biz/faq/how-to-create-a-sudo-user-on-ubuntu-linux-server/ it’s sudo. Something’s wrong here.

1 Like

@rautamiekka thanks for the heads up. The faq has been updated.

I followed the instructions but still can’t get sudo [command] to work. I get this output: ‘[user] is not in the sudoers file. (…)’

I can verify my user is in the sudo group when I run ‘id [user]’ or ‘groups [user]’

Does this mean I have to manually edit the sudoers file?

@alexnix, can you state your Linux distro name? On same distro you may have to edit the sudoers files to grant group access. Typically line on a Debian look like as follows:

%sudo	ALL=(ALL:ALL) ALL

I’m using Debian 10 and hating it so far. Lol

that line is already present in /etc/sudoers

Any idea as to why ‘sudo’ is still not working?

Are you sure the line is not commented out? It should be:

%sudo	ALL=(ALL:ALL) ALL

Not as follows:

#%sudo	ALL=(ALL:ALL) ALL

What about the id command? What it says?

id username
cat /etc/group | grep sudo 

Do you see sudo group attached to the username? Also check /etc/sudoers.d/ directory too (do you see any additional files? If so, paste those config here). Some cloud service provider modifies sudo behaviour for management purposes. Are you using Debian 10 with cloud service provider? If so let us know the name.


Linux sysadmin blog - Linux/Unix Howtos and Tutorials - Linux bash shell scripting wiki