The primary method for managing elevated permissions is the sudo command. Using the sudo command will grant elevated rights. Rights for a few minutes in supported versions of Ubuntu. We will walk you through the procedure of adding a user to Ubuntu’s sudoers list. sudo group to provide them with the rights they need to carry out administrative operations.

This guide will provide you with the skills you need to properly manage user access. Even if you are an Ubuntu user wishing to increase your rights. The VPS hosting in Japan provides a high-END server which is ideal for developing web pages in a secure and adaptable infrastructure.

Standard user accounts cannot access the contents of the root directory. It carries out any delicate operations. This stops commands with serious implications from being accidentally used. Additionally, it makes it harder for hackers to undermine a system. But occasionally you have to issue an administrative command. Super User Do, or sudo, permits you to carry out delicate operations. This will help you in adding a user to sudoers. Our private hosting offers vps including cPanel which is a great way to get your installed server without delay.

Adding a Sudo User in Ubuntu Step-by-Step

Step 1: First of all Create a New User

1. Log in to the system as the root user or with a user account that has sudo rights.

2. Launch a terminal window and execute the following command to add a new user:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
adduser newuser
adduser newuser
adduser newuser

The adduser command adds a new user to the system along with a group and home directory.

If your privileges are insufficient, you can receive a notice. (This mainly happens to non-root users.) Enter to get around it:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
sudo adduser newuser
sudo adduser newuser
sudo adduser newuser

3. Any username is acceptable in place of a newuser. The system will request that you enter a password after you have added the new user. Create a secure password, then type it again to be certain.

4. The system will ask you to enter more user-specific information. Name, phone numbers, and other fields are included; you can omit them by pressing Enter.

command to add new user in ubuntu

Step 2: After the First Step, Command to Add User to the Sudo Group

There is a user group for sudo users on the majority of Linux distributions, including Ubuntu. Add the new user to the sudo group to give them enhanced permissions.

Send the following command to a terminal:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
usermod -aG sudo newuser
usermod -aG sudo newuser
usermod -aG sudo newuser

Use the username you entered in Step 1 in place of “newuser.”

Once more, if you encounter a problem, issue the following command with sudo:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
sudo usermod -aG sudo newuser
sudo usermod -aG sudo newuser
sudo usermod -aG sudo newuser

The -aG option instructs the system to add the given user to the group. (Only G is supported by the -a option.)

run command to add user to sudo group

Step 3: Test User’s Membership in the Sudo Group

To view the groups a user is a member of, enter the information below:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
groups newuser
groups newuser
groups newuser

In response, the system will list the user’s username together with every group to which it belongs, as in newly created user: sudo

Step 4: Finally, Verify Sudo Access

Entering the following command you can switch the user.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
su - newuser
su - newuser
su - newuser

The username you specified in Step 1 should be substituted for the new user. If asked, enter your password. By just inputting commands, you can execute them as usual.

Example:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
ls /home
ls /home
ls /home

Some places or commands demand elevated rights, nevertheless. You will see the following access denied error if you attempt to list the contents of the /root directory: /root ls

The command can be carried out using:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
sudo ls /root
sudo ls /root
sudo ls /root

Your password will be requested by the system. Use the password you created in Step 1 as well. The contents of the /root directory should now be visible.

apply the command to verify sudo user on ubuntu

Conclusion

In conclusion, adding a user to Ubuntu’s sudoers list and sudo group is a simple step. Hope you got an idea about add user sudoers Ubuntu in simple words and simple way. Steps that give them administrative rights. Improves their capacity to handle the system successfully. You may guarantee that authorized users have the required permissions to issue—an administrative command by following the instructions.

The ability to add users to the sudoers list and the sudo group gives you or your team members. That gives the freedom to carry out important administrative activities with ease. This knowledge improves productivity and efficiency while also streamlining system management. To track the changes to the file you need to install git on Ubuntu and understand it in detail.