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?
Best Answer
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 usesudo
with their password (just like the standard first user):If you've already created the user, you can just run:
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 ofsudo
.