How to Add and Delete Users on Debian 12
Updated on
•6 min read

Adding and removing users is one of the first tasks when provisioning a new Debian system.
Debian, like other Linux distributions, is a multi-user OS. Users can have different permissions and settings for various CLI and GUI apps.
If you’re a Linux user, it’s crucial to have basic skills like adding and removing users. This makes your system more secure by ensuring only authorized users can access protected resources and perform specific actions.
This article describes how to add and remove users on Debian 12.
Prerequisites
You need administrative privileges to add or remove user accounts on your Debian system.
How To Add User in Debian
In Debian, there are two command-line tools that you can use to create a new user account: useradd
and adduser
.
useradd
is a low-level command line tool used for creating a new user account in Linux operating systems. On the other hand, adduser
is a Perl-based utility that provides a more user-friendly and interactive front-end to the useradd utility. It is designed to simplify the process of creating new user accounts.
To create a new user account named leah
using the adduser
command, you would run:
sudo adduser leah
Adding user `leah' ...
Adding new group `leah' (1001) ...
Adding new user `leah' (1001) with group `leah (1001)' ...
Creating home directory `/home/leah' ...
Copying files from `/etc/skel' ...
You will be asked a series of questions. Entering and confirming the password is required; all other information is optional.
New password:
Retype new password:
passwd: password updated successfully
Changing the user information for leah
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]
Adding new user `leah' to supplemental / extra groups `users' ...
Adding user `leah' to group `users' ...
On the last prompt, confirm that the information is correct by pressing Enter
.
The command will create the new user’s home directory and copy files from /etc/skel
directory to the user’s home directory. The user can write, edit, and delete files and directories within the home directory.
By default on Debian, members of the group sudo are granted with sudo access. If you want the newly created user to have administrative rights, add the user to the sudo group :
sudo usermod -aG sudo leah
How To Delete a User in Debian
If the user account is no longer needed, you can delete it with userdel
or deluser
. Generally, it is better to use the deluser
command as it is more friendly than the low-level userdel
.
To delete a user, without removing the user files, run:
sudo deluser leah
Removing crontab ...
Removing user `leah' ...
Done.
When removing a user account with userdel
, the user’s home directory and mail spool are not removed. To remove those directories, invoke the command with the --remove-home
flag:
sudo deluser --remove-home leah
Looking for files to backup/remove ...
Removing files ...
Removing crontab ...
Removing user `leah' ...
Done.
Conclusion
We have shown you how to easily add and remove users in Debian. The same commands apply to any Debian-based distribution.
Feel free to comment if you have any questions.