How to create a user with root privileges in bash?

Haven't tried it but this should create a new user and add them to the sudo group, which if your /etc/sudoers is as default, should mean they're allowed to use sudo with their password (just like the standard first user):

sudo adduser --group sudo newusername

If you've already created the user, you can just run:

sudo adduser existing_user sudo

man adduser will show you some of the other billion permutations and combinations of arguments this tool has.

Note: If you use Ubuntu 11.10 or older, you should use the admin group instead of sudo.


I found some sites where they do the: sudo adduser paul admin

but my linux does not have the admin group so I use:

sudo adduser paul sudo

"System account" just means that the user will get an UID (user identifier) from a reserved range, it doesn't give any extra permissions. The right way to elavate privileges is to use sudo, as described by Oli.