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.

I have run the following commands:

sudo groupadd -r testgroup
sudo useradd -g testgroup -M -r testuser

Notice the -r option, which according to the man page:

-r
    Create a system account.

Assuming I have a user account with root privileges, I then run:

sudo -u testuser cat /dev/input/mouse0

However, I get:

cat: /dev/input/mouse0: Permission denied

Running the same command as root provides the expected output (garbled output from the mouse driver).

How can I create a user with root privileges?

share|improve this question

3 Answers 3

up vote 14 down vote accepted

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.

share|improve this answer
    
Ah... no wonder it wasn't working. –  Nathan Osman Mar 31 '11 at 0:11
    
For 12.04 (Precise) and newer: The default group for root privileges is sudo but admin will work too. However, new installs won't have the admin group created at all. –  papukaija Dec 27 '12 at 0:29
    
On Ubuntu 14.04 I get adduser: Specify only one name in this mode. when executing sudo adduser --group sudo ubuntu –  Yura Jul 30 at 17:39

"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.

share|improve this answer

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
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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