How to Create and Sudo Sudo Users Group in Ubuntu – The command sudois the preferred way to handle elevated permissions. In versions of Ubuntu are supported, use the sudo command will provide high clearance for 15 minutes.

Standard user account is prohibited to perform sensitive tasks, such as viewing the content directory / root. This prevents inadvertently Usage command with major consequences. It also makes it more difficult for intruders to compromise a system. But sometimes, you need to run administrative commands. Sudo – or Super User Do – gives you the privilege to perform sensitive tasks.

This simple tutorial will show you how to create and add a new user in Ubuntu and provide access to sudo.

Important : By having this user sudo account, you will often use a user with sudo privileges to install various packages that I will explain in the next tutorials, all of which are required to use sudo user privileges.

Requirements Create a User Sudo and Sudo Group in Ubuntu

  • Systems running a supported version of Ubuntu
  • Access to the root user account or another account with sudo rights
  • Access to the terminal window / command line ( Ctrl-Alt-T)

Read: How to Install and Use Docker in Ubuntu 18:04

What it Sudo?

Sudo is a program similar to the Unix computer operating system that allows users to run programs security rights of other users, by default is the “superuser”. Originally an acronym for “superuser do” because sudo on versions older designed to run programs just as superuser.

However, future versions add support for running commands not only as the superuser but also as a user (restricted) else, so it is also generally developed as a “substitute user do”. Although the latter case it reflects the current functionality in a more accurate, sudo is often called the “superuser do” because it is often used for administrative tasks.

Steps for Creating and Adding Users Sudo in Ubuntu

Step 1: Create a new user

1. Log in to the system with root user or account with sudo rights.

2. Open a terminal window and add a new user with the command:

$ adduser newuser

The command adduser create a new user, create a group and to the user’s home directory.

You may get an error message that you have insufficient privileges. (This usually only occurs for non-root user.) Please type the following command and enter:

$ sudo adduser newuser

3. You can replace a new user with the user name you want. The system will add a new user; and then ask you to enter the password. Enter the password safe which was great, then retype it to confirm.

4. The system will prompt you to enter additional information about the user. This includes name, phone number, etc. – This field is optional and you can skip by pressing the Enter key .

make-sudo-user-ubuntu 1
Create a User Sudo and Sudo Group in Ubuntu

Step 2: Add users to the group sudo

Most Linux systems, including Ubuntu, have a user group for user sudo. To give precedence to the new user, add them to the sudo group.

In the terminal, enter the command:

$ usermod –aG sudo newuser

Replace a new user with a user name you entered in Step 1.

Again, if you get an error, run the command with sudo as follows:

$ sudo usermod –aG newuser

Options – ag to tell the system to add users to the specified group. (Options – A only be used with G .)

make-sudo-user-ubuntu 2

Step 3: Verify Owned user group sudo

Enter the following command to see which group belongs to the user:

$ groups newuser

The system will respond by registering a user name and all the groups that have, for example: newuser: newuser sudo

Step 4: Verify sudo access

Replace user by entering: $ su – newuser

Replace a new user with a user name you entered in Step 1. Enter your password when prompted. You can run as usual, just by typing them.

As an example: $ ls /home

However, some commands or location requires elevated privileges. If you try to make a list of the contents of the directory / root , you will get access denied error:ls /root

Commands can be executed: sudo ls /root

The system will ask for your password. Use the same password you set in Step 1. Now you will see the contents of the directory / root .

create-user-ubuntu sudo 3

Conclusion

Now that you know how to add and create a user with sudo rights in Ubuntu.

Prior to sudo, the user will get into systems with full permissions on the whole system. This is risky because the user can be exploited by tricking them to insert malicious commands. This vulnerability is solved by restricting the account privileges. However, administrators still have to go out of their account and sign in to the admin account to perform routine tasks.

Sudo in Ubuntu created a user account that protect the balance of the possibility of damage malicious or accidental while allowing the user who has privileges to perform administrative tasks.