How to Add and Remove Users on Ubuntu 20.04

In this article i will show how you can add and remove user on Ubuntu 20.04. This will be very basic steps on linux user administration.

1) How to create new user.

Note : Please note that this command need to be performed with user with administrative privileged or already in sudo group member :

$ sudo adduser linodelinux

Sample output :

Adding user `linodelinux' ...
Adding new group `linodelinux' (1001) ...
Adding new user `linodelinux' (1001) with group `linodelinux' ...
Creating home directory `/home/linodelinux' ...
Copying files from `/etc/skel' ...
New password:
Retype new password:
passwd: password updated successfully
Changing the user information for linodelinux
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] y

2) How to delete the user, invoke the deluser command and pass the username :

$ sudo deluser user1

Note : However above command will not remove the user files.

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

$ sudo deluser --remove-home user1

Leave a Comment