How to Add or Remove Users on Ubuntu 20.04?
This article discusses how to add or remove users in Ubuntu 20.04. A Linux administrator has to manage the user accounts and to add or remove the users.
A user can be added by means of a command line or the GUI. We will guide you through this post how to carry out this task using both methods on Ubuntu OS. Both have been tested on the Ubuntu 20.04 LTS (Focal Fossa).
Adding user through command line
This is very simple. Open the command line on Ubuntu by Ctrl+Alt+T shortcut. Now in order to add a user, the following syntax is used to run command in terminal:
$ sudo adduser <username>
The name of actual user is put in place of <username> that you intend to create on Ubuntu.
Following the add user command, you are directed to create the sudo password. After creation of password, more information is required for user account. You can click Enter to accept the defaults or enter new values.
Finally, you will agree that the information is correct by pressing y and new user account will be created.
The newly created account can also be given sudo privileges. In order to avail sudo privileges, the user account should be added to sudo group.
The following command Terminal helps us carry out this task:
$ sudo usermod -aG sudo <username>
Actual user name should be put in place of <username> on Ubuntu.
Thus the newly created user is added to the sudo group which is verified by the given command:
$ groups <username>
Removing a User with Command Line
If you want to remove certain user account from Ubuntu system, the command terminal as follows can be used:
$ sudo deluser <username>
This command will erase the user account from the system but the Home Directory of the user account cannot be removed through this command.
If removal of user account with its Home Directory is intended then this command in Terminal is run:
$ deluser –remove-home <username>
Adding a User via GUI
If command line is not your favorite working tool, you can add a user graphically.
The Settings utility is used for this purpose. Right- click the Ubuntu desktop and select Settings.
Follow the left pane to reach the Users tab.
In the right pane select the Unlock option to change settings.
Next Authenticate button is selected to get authentication for password. Settings will get unlocked and new user can be created.
Select the Add User button at the top of the Settings window so as to create new user account.
Next you have to select form account type based on accessibility as Standard or Administrator. Entering Full Name will automatically become Username.
Account password can be set in this setting or in the next login since both option are given next.
In the end selecting Add button will create New User.
Removing User by GUI
Likewise, Settings utility is opened by right-clicking Desktop. In the left pane Users tab is opened.
The Unlock button is selected to change the settings. Password is provided for authentication.
Select Remove User for the User to be removed.
Option will appear on the screen as to keep or delete the user account files including Home Directory.
This way User can be added or removed on Ubuntu and give administrator privileges. Either method can be chosen to carry out the task.
My name is Akhunzada Younis Said. I am a software project manager in HAZTECH, a software engineering graduate and a content writer. I love working with Linux, Data science and open-source software.