During installation of Ubuntu there is only one privileged user who has root and any ability to manage the computer. After installation is complete, you receive access to create an unlimited number of new users, setting each of their rights, home folder, the date of shutdown, and many other settings. In today’s article we will try as much detail as possible to tell about this process, citing the description of each present in OS commands.
Add a new user to Ubuntu
You can create a new user in one of two ways, and each method has its specific settings and will be useful in different situations. Let’s analyze in detail each variant of the implementation of the task, and you, based on their needs, choose the most optimal.
Method 1: Terminal
An indispensable app on any operating system on the kernel Linux “Terminal”. This console is a wide variety of operations, including adding users. Involved will be only one built-in utility, but with different arguments, which we describe below.
useradd -Dto see default settings that will be applied to the new user. Here you will see the home folder, libraries, and privileges.
sudo useradd name, where name is any name the user entered in Latin characters.
In this procedure you create an account with the default settings completed successfully, after activation of the command displays the new field. Here you can enter the argument -p, putting the password, and the argument -sby setting the used shell. An example of this command is:
sudo useradd -p password -s /bin/bash userwhere passsword is any password /bin/bash is the location of the shell and the user — name of the new user. This creates a user with the application of certain arguments.
We would like to draw attention to the argument -G. It allows you to add the account to the appropriate group for specific data. Of the main groups are such:
- adm — permission to read logs from the folder /var/log;
- cdrom — allowed to use the drive;
- wheel — ability to use the command sudo to grant access to specific tasks;
- plugdev — permission to mount external drives;
- video, audio — access to audio and video drivers.
In the screenshot above you see, in what format are injected groups when using the useradd command with the argument -G.
Now you are familiar with the procedure of adding the new accounts via the console on Ubuntu, but we have not considered all the arguments, but only a few basic. Other popular commands have the following designations:
- -b — use the base-directory for placing files of the user, usually this folder is /home;
- -c — add a comment to the record;
- -e — the time after which the created user will be blocked. Fill should be in the format YYYY-MM-DD;
- -f — lock the user immediately after adding.
Examples of the assignment of the arguments you have already been introduced above, to issue all should be as shown in the screenshots, using the space bar after entering each phrase. It is also worth noting that each account available for further modification through the same console. To do this, use the command
sudo usermod userby inserting between usermod and user (user name) required parameters with values. This applies not only to change the password, it is replaced by using
sudo passwd user 12345, where 12345 is the new password.
Method 2: Menu “Settings”
Not everyone is convenient to use the Terminal and understand all these arguments, teams, besides, it is not always required. So we decided to show the more simple, but less flexible method of adding a new user through the GUI.
The above two options to work with your accounts will help you correctly configure groups in the operating system and to put each user their privileges. With regard to the removal of unnecessary entries, made it through the same menu “Options” or with command
sudo userdel user.