How to add sudo users in Linux
First of all you have to be logged in as root. Just type command below followed by your password:
terminator@skynet:~$ sudo su -
[sudo] password for terminator:
Now that you are root you can use the following command to create the user:
adduser <username>
You will be prompted for password, information and confirmation. Once done you can use the following command to give SUDO powers to that user:
usermod -aG sudo <username>
Done!
Here is an example of the console output:
root@skynet:~# adduser sconnor
Adding user `sconnor' ...
Adding new group `sconnor' (1004) ...
Adding new user `sconnor' (1004) with group `sconnor' ...
Creating home directory `/home/sconnor' ...
Copying files from `/skynet/skel' ...
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
Changing the user information for sconnor
Enter the new value, or press ENTER for the default
Full Name []: Sarah Connor
Room Number []:
Work Phone []:
Home Phone []:
Other []:
Is the information correct? [Y/n] Y
root@skynet:~# usermod -aG sudo sconnor
root@skynet:~#
Hasta la vista baby!
Sources: