I want to add new user and have/grant that new user to have all the root access, how can I do that ?
sudo adduser --system testuser but this is not working as I expected.
Thanks for help.
There are actually three ways you can do this: the right way, the wrong way, and the ugly way.
First, create a normal user account.
Then select one of the following:
The Right Way
Or for "modern" versions:
Then add the user to the
Note that some distributions use different administrative accounts. Wheel is a "traditional" approach to this, but you may encounter
I have to give a point to Bart Silverstrim for pointing out that Ubuntu uses
The Ugly Way
Create a sudo entry for the user account in question and give then complete access. Again, you create the entry in
ADDED: ## For Ubuntu version: username ALL=(ALL:ALL)
This is great if you only have one (or two) normal accounts. It is ugly when you have a hundred accounts over multiple (geophysical) sites and have to constantly maintain the sudo file.
The Wrong Way
You can edit the
See that third entry as zero? When you log into that account, you are, for all effective purposes,
If you did this, you did use
I've been using this for years and it's the #1 recommended way to add a sudoer on AskUbuntu:
Much simpler than editing files, and easy to throw in a shell script for unattended installation.
If you want to create the user and grant sudo privileges, you can do that in one line like this:
and with this is 100%:
and connect with putty and ip server
Well you may create user with adduser, see man adduser.
The "ugly and messy" way is to edit /etc/passwd to have UID=0 AND GID=0 for the new user. But this poses a LOT of security risks. You do know that if he is also root he may disable your accont, change your password, make you a "standard user"... right? so why not just give him you own account?
You may study the way suid (http://en.wikipedia.org/wiki/Setuid) works if you want to grant him root access for just a few of the commands.
Addition to Avery Payne's answer: in Ubuntu, you may want it like so:
And not like so:
it creates a user Alex with a home directory who belongs to the root group