Logo
  • Ubuntu
  • CentOS
  • Debian
  • Fedora
  • RedHat

How to Add and Remove Users on Ubuntu 20.04 - DesignLinux

Aug 22 2020
designlinux 0 Comments

One of the first tasks when provisioning a new Ubuntu system is adding and removing users. Each user can have different permission levels and specific settings for various command-line and GUI applications.

This article explains how to add and remove user accounts on Ubuntu 18.04.

Before You Begin #

Only root or users with sudo privileges can create and remove users.

New users can be created in two ways:

  1. From the command line.
  2. Through the GUI.

Adding a User from the Command Line #

In Ubuntu, there are two command-line tools that you can use to create a new user account: useradd and adduser.

useradd is a low-level utility. adduser is a script written in Perl that acts as a friendly interactive frontend for useradd.

Adding a new user is quick and easy, simply invoke the adduser command followed by the username. For example, to create a new user account named username you would run:

sudo adduser username
Adding user `username' ...
Adding new group `username' (1001) ...
Adding new user `username' (1001) with group `username' ...
Creating home directory `/home/username' ...
Copying files from `/etc/skel' ...

You will be asked a series of questions. Enter and confirm the new user password. Providing an answer to all other questions is optional.

Enter new UNIX password: 
Retype new UNIX password: 
passwd: password updated successfully
Changing the user information for username
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] 

At the end, you’ll be prompted to confirm that the information you entered is correct.

The command will create the new user’s home directory, and copy files from /etc/skel to it. Within the home directory, the user can write, edit, and delete files and directories.

If you want the new user to be able to perform administrative tasks, you need to add the user to the sudo group :

sudo usermod -aG sudo username

Adding a User through the GUI #

If you are not comfortable with the command line, you can add a new user account through the GUI. To do so, follow the steps below:

  1. Open the settings window and click on the “Users” tab.

  2. Click on the “Unlock” button, and enter your user password when prompted.

    Once you enter the password, the “Unlock” button will change to a green “Add User” button.

  3. Click on the “Add User” button, and the Add user dialog will appear:

  4. Select whether the new user should be a standard or administrator user and enter information. Once done, click on the “Add” button.

Removing a User from the Command Line #

In Ubuntu, you can use two commands to delete a user account: userdel and its interactive frontend deluser.

To delete the user, invoke the deluser command and pass the username as the argument:

sudo deluser username

The command above will not remove the user files.

If you want to delete the user and its home directory and mail spool, use the --remove-home flag:

sudo deluser --remove-home username

Removing a User through the GUI #

  1. Open the settings window and click on the “Users” tab.

  2. Click on the “Unlock” button, and enter your user password when prompted.

  3. Click on the username you want to delete, and you will see a red “Remove User..” button on the bottom right corner.

  4. Click the “Remove User..” button, and you will be prompted whether to keep or delete the user home directory. Clicking on one of those buttons removes the user.

Conclusion #

We’ve shown you how to add and remove users in Ubuntu 20.04. Knowing how to add and remove users is one of the basic skills a Linux user should know.

Feel free to leave a comment if you have any questions.

terminal user ubuntu useradd userdel

Related

Tags: terminal, ubuntu, user, useradd, userdel

How to Install Tor Browser on Ubuntu 20.04

Prev Post

How to Create and List Local and Remote Git Branches

Next Post
Archives
  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022
  • July 2022
  • June 2022
  • April 2022
  • March 2022
  • February 2022
  • January 2022
  • December 2021
  • November 2021
  • October 2021
  • September 2021
  • August 2021
  • July 2021
  • June 2021
  • May 2021
  • April 2021
  • March 2021
  • February 2021
  • January 2021
  • December 2020
  • November 2020
  • October 2020
  • September 2020
  • August 2020
  • July 2020
  • June 2020
  • May 2020
Categories
  • AlmaLinux
  • Android
  • Ansible
  • Apache
  • Arch Linux
  • AWS
  • Backups
  • Bash Shell
  • Bodhi Linux
  • CentOS
  • CentOS Stream
  • Chef
  • Cloud Software
  • CMS
  • Commandline Tools
  • Control Panels
  • CouchDB
  • Data Recovery Tools
  • Databases
  • Debian
  • Deepin Linux
  • Desktops
  • Development Tools
  • Docker
  • Download Managers
  • Drupal
  • Editors
  • Elementary OS
  • Encryption Tools
  • Fedora
  • Firewalls
  • FreeBSD
  • FTP
  • GIMP
  • Git
  • Hadoop
  • HAProxy
  • Java
  • Jenkins
  • Joomla
  • Kali Linux
  • KDE
  • Kubernetes
  • KVM
  • Laravel
  • Let's Encrypt
  • LFCA
  • Linux Certifications
  • Linux Commands
  • Linux Desktop
  • Linux Distros
  • Linux IDE
  • Linux Mint
  • Linux Talks
  • Lubuntu
  • LXC
  • Mail Server
  • Manjaro
  • MariaDB
  • MongoDB
  • Monitoring Tools
  • MySQL
  • Network
  • Networking Commands
  • NFS
  • Nginx
  • Nodejs
  • NTP
  • Open Source
  • OpenSUSE
  • Oracle Linux
  • Package Managers
  • Pentoo
  • PHP
  • Podman
  • Postfix Mail Server
  • PostgreSQL
  • Python
  • Questions
  • RedHat
  • Redis Server
  • Rocky Linux
  • Security
  • Shell Scripting
  • SQLite
  • SSH
  • Storage
  • Suse
  • Terminals
  • Text Editors
  • Top Tools
  • Torrent Clients
  • Tutorial
  • Ubuntu
  • Udemy Courses
  • Uncategorized
  • VirtualBox
  • Virtualization
  • VMware
  • VPN
  • VSCode Editor
  • Web Browsers
  • Web Design
  • Web Hosting
  • Web Servers
  • Webmin
  • Windows
  • Windows Subsystem
  • WordPress
  • Zabbix
  • Zentyal
  • Zorin OS
Visits
  • 0
  • 67
  • 605,817

DesignLinux.com © All rights reserved

Go to mobile version