Tag Archives: sudo

Enabling Sudo Access via Cli

You will need to be root to create this new user. Once the user has sudo access they will have the same rights as the root user

1. Create the user

adduser kmarquis

When you create the user you get this output.

Adding user `kmarquis' ...
Adding new group `kmarquis' (1001) ...
Adding new user `kmarquis' (1001) with group `kmarquis' ...
Creating home directory `/home/kmarquis' ...
Copying files from `/etc/skel' ...
Enter new UNIX password: #Set Password
Retype new UNIX password: #Confirm Password
passwd: password updated successfully
Changing the user information for user
Enter the new value, or press ENTER for the default
Full Name []:
Room Number []:
Work Phone []:
Home Phone []:
Other []:
Is the information correct? [Y/n] y

2. Grant them sudo access by either:

a) usermod -G sudo kmarquis

or

b)  visudo
look for the line

root (ALL=ALL:ALL) ALL

add below:

kmarquis (ALL=ALL:ALL) ALL

Hit Ctrl + X then Enter.

Now with whatever method used, the user will have root privileges via sudo. If you need to make any changes that require root access, you just need to enter sudo before the command. You will be prompted for your password before the command is run

[email protected]:~$ sudo apt-get update
[sudo] password for kmarquis:

Share this:
Share