If you want to create a new Ubuntu user, you can do it in a few steps. You can then add the new account to the Sudo group if necessary.
Ubuntu 20.04: Create a user with sudo rights
Linux command sudo
Allows users to initiate instructions with the privileges of the Root administrator. This gives them temporary administration rightswhich must however be configured beforehand by an administratorwhether for an existing user account or when creating a new account in Ubuntu.
In the following paragraphs, you will discover how to create a new user with adduser
In Ubuntu 20.04, then how he assign administration rights with sudo
.
Note
The term sudo means » superuser ». It is an command used under the UNIX -based systems, such as Ubuntu, to perform administrative tasks requiring high privileges. These privileges are granted to users members of the group sudowhich controls access to this order.
Backup Cloud by Acronis
Protect your devices and reduce downtime
- Automatic backup and easy catering
- Intuitive management and planning
- Protection against threats based on AI
Execute adduser
In Ubuntu 20.04
If you want to create a new user ( » Add User ) Ubuntu, you must first connect to your server. To do this, use the following command, replacing the generic entry « your_server » with the real IP address of your server:
$ ssh root@votre_serveur
bash
Secondly, use the command adduser
To create an Ubuntu account for a new user. In our example, this one is called « stone ».
The system now asks you to create a secure password for the new user. Type this password after the two points and repeat it on the line below:
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
bash
Then, you will be asked to provide some information on the new user. You can also ignore this information. When you have finished, confirm with Y
.
Changing the user information for pierre
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]
bash
This step is now over. If you want to create another user under Ubuntu, repeat the same procedure.
Grant Sudo rights to an account
If you wish to grant administrative rights to a new user or an existing account, you must use an administrator account or have privileges sudo
. The addition of an account to the Sudo group must however be reserved for trusted users, because all the accounts of this group by default of complete administration privileges. These privileges make it possible to carry out almost all system actions, in particular modify system files, install or delete software, and configure network services.
For our “stone” user, the corresponding command is as follows:
$ usermod -aG sudo pierre
bash
Just replace the name « stone » with the name of your new user.
Check the privileges sudo
After carrying out the « Create User » action under Ubuntu and added the new account to the Sudo group, you can check the success of these actions as follows:
This command allows you to go to the profile of the new user. Now run, as a test, an order requiring privileges sudo
. The following command gives access to the directory /Rootwho is not accessible only to super users ::
You will then be asked to enter the password of this account. If it has been successfully added to the Sudo group, you will now have access to the repertoire /Root.
Note
Make sure you only use root access when it is absolutely necessary and system safety is taken into account. Ideally, you should work with a non -root user account that has received the rights to sudo
.