November 2, 2024
Tutorials

How to Add and Delete Users in Debian 12

How to Add and Delete Users in Debian 12

A user in any operating system, including Debian 12, is an individual account. These users have personalized system settings according to their needs.

For managing system security, it is important to add or remove users from your Debian system.

You can allow the users to log in and perform tasks using your system by adding users. On the other hand, you can remove users who are no longer required.

This guided post explains how one can add and/or remove users in the Debian 12 system.

How to Add and Delete Users in Debian 12?

Through this guided post, you will learn:

  • How to Add Users in Debian 12?
  • How to Delete Users in Debian 12?

How to Add Users in Debian 12?

The Debian 12 can be utilized to add users with just a simple process.

Step 1: Add User via Terminal

From the Debian Activities, launch the terminal window and run the below-mentioned command to add a new user (i.e. user-1). During the adding process, you will be prompted with a few questions, respond to them accordingly:

sudo adduser user-1
sudo adduser user-1

At the end of the process, you will see that the new user has been added to your Debian 12 system

Step 2: Grant Superuser Privileges

Through the command, you can add the “user-1” to the sudo group to grant the superuser privileges on your Debian system:

sudo usermod -aG sudo user-1
sudo usermod -aG sudo user-1

Now, the “user-1” will have sudo privileges on the system.

Step 3: Verify the Added User

To inspect the list of all users along with their details, execute the command:

sudo cat /etc/passwd
sudo cat /etc/passwd sudo cat /etc/passwd

Here, you can verify the new user (i.e. user-1) at the end of the provided list.

How to Delete Users in Debian 12?

Debian 12 provides a simple command, as given below, to delete users from your system.

Step 1: Remove User Completely

You can use the Debian terminal to delete the user and remove their home directory from your system:

sudo deluser user-1 --remove-home
sudo deluser user-1 --remove-home

This command has completely removed the “user-1” and its associated files including the home directory.

Step 2: Confirm User After Removal

Once you have deleted the user-1 from your Debian system, you can confirm it using the command:

sudo cat /etc/passwd | grep "user-1"
sudo cat /etc/passwd | grep "user-1"

If the command does not return information about “user-1”, it indicates that the user has been completely removed from your Debian system.

Conclusion

Debian 12 provides simple methods to add and delete users from your system. You can add a new user via “sudo adduser user_name”, while to remove them, utilize the command “sudo deluser user_name –remove-home”. In this article, you utilized simple commands to add and remove the user from the Debian 12 system.

Leave feedback about this

  • Quality
  • Price
  • Service

PROS

+
Add Field

CONS

+
Add Field
Choose Image
Choose Video