How to Add and Delete Users on Debian 12

User management is an important task in the management of Linux distributions. To make sure the information on the computer is safe, only specified users should be allowed to access it. 

To add the new users to different groups of Debian 12 as well as to remove the users from groups has been explained in this blog. The users who are added to the groups are given the privileges of the group’s permissions. 

Let’s start the post with an understanding of the “User Management” in Debian 12. 

What is User Management in Debian 12?

There are two types of users in Debian 12 which are:

  • System Users: System users are mostly created during the installation process. These user accounts are used to run the system processes. 
  • Regular Users: Regular users can interact with the Debian 12 and they have their own user identity (UID) and group identity (GID). They have their own directories and permissions. 

The regular users are added to the common groups in which the permissions to read, write, and execute are given to all the members of the same group. 

How to Display the Users in Debian 12?

We can display both, the System Users and Regular User.

System Users 

To display the system users in the Debian 12, list down the /etc/passwd directory:

$ cat /etc/passwd
1Add and Delete Users on Debian 12
Add and Delete Users on Debian 12a

We have the “vboxuser” in the system group. 

Regular Users

Similarly, to display the regular groups, for example, we display the members of the “ItsLinuxFoss” group:

$ grep ‘ItsLinuxFoss’ /etc/group
Add and Delete Users on Debian 12b

Maddox” is a member of the “ItsLinuxFoss” group. 

How to Add a User in Debian 12?

Methods of adding users in both, System Users and Regular Users have been explained.

System Users

To add the system user in Debian 12, use the “adduser” command with the “sudo” privileges specifying the user name. For example, add another system user with the name of “Milton” in Debian 12:

$ sudo adduser Milton
Add and Delete Users on Debian 12c

When the command is executed, it will ask to set a password for the new user. Type the password and press the “ENTER” key to proceed with 

the process:

Add and Delete Users on Debian 12d

The user has been created in the “users” group. To confirm this, display the members of the “users” group:

$ grep ‘users’ /etc/group
Add and Delete Users on Debian 12e

Milton” has been created with the “vboxuser” in the System users group. 

Regular User

To understand the method of adding the “Regular User”, we will add the user “Henry” to “ItsLinuxFoss” group:

$ sudo useradd -G ItsLinuxFoss Henry
Add and Delete Users on Debian 12f

To confirm the addition of the new member in “ItsLinuxFoss” group, use the command:

$ grep ‘ItsLinuxFoss’ /etc/group
Add and Delete Users on Debian 12g

Henry” has been added successfully to the “ItsLinuxFoss” group. 

How to Delete a User in Debian 12?

To delete a System user and Regular user, use the below-mentioned commands.

System Users

To delete the “System User”, use the “deluser” command utility. For example, delete the “Milton” user with the command:

$ sudo deluser milton
Add and Delete Users on Debian 12h

For the confirmation of the above command, display the members of the “users” group:

$ grep ‘users’ /etc/group
Add and Delete Users on Debian 12i

User “milton” has been deleted successfully. 

Regular User

To delete the regular user from Debian 12, again use the “deluser” command specifying the group name. For example, delete the “Henry” user from the “ItsLinuxFoss” group with the command:

$ sudo deluser Henry ItsLinuxFoss
Add and Delete Users on Debian 12j

The user Henry has been deleted which can be confirmed by running the command:

$ grep ‘ItsLinuxFoss’ /etc/group
Add and Delete Users on Debian 12k

The user “Henry” has been deleted successfully. 

How to Add and Delete the Users on Debian 12 using the GUI Method?

Another convenient method to add and delete users from Debian 12 is using the GUI method. In this method, open “Settings” from the application menu and choose “Users” from the menu:

Add and Delete Users on Debian 12l

Click on “Unlock” to allow access by providing the password of the root account:

Add and Delete Users on Debian 12m

Click on the “Add User” to add the user:

Add and Delete Users on Debian 12n

Then write the name of the user. Set the password right now or choose to set it later and then click on the “Add” button:

Add and Delete Users on Debian 12o

Similarly, to delete the user, click on the user name and scroll down the screen. Click on the “Remove User” to delete the user:

Add and Delete Users on Debian 12p

The user has successfully been deleted from Debian 12. 

Conclusion

To add and remove the users on Debian 12, either use the terminal or the GUI method. In the terminal use the “adduser” and “deluser” to add the users. In the GUI method, open the “Settings” application, and then navigate to the “Users” section for adding and deleting the users. In this post, adding and deleting users on Debian 12 by both CLI and GUI methods have been explained.