Create a New Sudo User
To add a new sudo user, open the terminal window and enter the command.
useradd tech_support
create a password for the new user by entering the following in your terminal window.
passwd tech_support
The system should display a prompt in which you can set and confirm a password for your new user account. If successful, the system should respond with “all authentication tokens updated successfully.”
Add User to Sudoers Configuration File
Open the Sudoers File in an Editor
In the terminal, run the following command.
visudo
Add the New User to file
Scroll down to find the following section
Allow root to run any commands anywhere
root ALL=(ALL) ALL
Right after this entry, add the following text
tech_support ALL=(ALL) ALL
This section should look like the following
root ALL=(ALL) ALLtech_support ALL=(ALL) ALL
Save and exit
:wq
Test Sudo Privileges for the User Account
Switch user accounts with the su
(substitute user) command
su – tech_support
Enter the password for the account, if prompted. The terminal prompt should change to include tech_support.
List the contents of the /root directory
sudo ls —la /root
Enter the password for this user when prompted. The terminal should display a list of all the directories in the /root directory.