In this guide, you will learn:
- How to Add a User in Debian 12
- How to Give sudo Privileges to a New User on Debian 12
- How to Fix username not in the sudoers file on Debian 12
- How to Add a User to Group in Debian 12
- How to Delete User in Debian 12
- How to Delete a User from Group in Debian 12
- Conclusion
How to Add a User in Debian 12
You can add a user in Debian 12 using:
How to Add a User in Debian 12 Using Terminal
You can add a user in Debian 12 using the adduser command in the terminal, this can be done from the following steps:
Step 1: First, open terminal and run the following adduser command with the required username you want to add on Debian:
Here, I have added username as linuxhint on Debian 12 using the command:
Note: You should run the above command with sudo privileges because you are going to do changes within the system.
Step 2: You must set a password for the new user you have added to the system:
Step 3: Enter the new value for the user you have added. You can also go with the default ones by pressing the Enter button on the options that appears on the terminal:
Step 4: Reply with Y to ensure the information you provided is correct, once done, your new user will be added to Debian 12:
How to Give sudo Privileges to a New User on Debian 12
After adding a new user, you must grant sudo privileges to that user so that you will be able to run commands in sudo privilege. You can add sudo privileges to your added user on Debian 12 using the following command:
To verify whether the new user is added to sudo users in Debian 12, you can use the following command:
Besides using the command, you can also configure the sudoers file to give sudo privilege to the new user on Debian 12. For this process, you must log in as the root user on Debian 12 using the following command:
Then open the sudoers file using the nano editor from the below-given command:
Inside the file, you have to add the following line right under the root user privilege specification:
Note: Replace username with the user you have added to Debian 12:
Then save the file using CTRL+X, add Y and press Enter.
How to Fix username not in the sudoers file on Debian 12
The error username not in the sudoers file is mostly encountered by the Debian users who have recently started using the Debian system and run sudo commands:
By default, Debian doesn’t allow sudo privileges to the users. Thus, you have to add your user to sudoers file or add the user to sudo group using the previous-mentioned methods to fix this issue on Debian 12.
How to Add a User to a Group in Debian 12
Adding a user to a group is a useful task that can be done on Debian since it organizes the users and defines their roles and responsibilities. The users of the same group have the same privileges to execute a task on the system.
To add a user to a group on Debian, you first need to create a group from the command given below:
You can then verify the group using the following command:
After that, you can add a specific user to your group using the below-given command:
To verify the identity of the user on Debian 12, you can use the command given below:
How to Add a User in Debian 12 Using GUI
You can also add a user in Debian 12 from the GUI using the following steps:
Step 1: Open Settings on Debian 12 from desktop by clicking on any icon (Battery, Sound or Network). You can also open Settings from the application menu:
Step 2: Scroll down and navigate to the Users option:
Step 3: Click on the Unlock button to unlock the Add Users and Change Settings:
Step 4: Provide the administrator password, then click on the Authenticate button to unlock the settings:
Step 5: Now click on the Add User option:
Step 6: Write name, username, choose set password now option then set a strong password and click on the Add button to add the username to Debian 12:
Once completed, you will see that your username will be added to the Users section in Debian 12:
How to Delete User in Debian 12
If you have created a new user in Debian 12 and want to remove it, you can simply use the deluser command with sudo privileges and the required username:
Note: You must switch to another user if you are going to remove the username you currently logged in. To switch to other user on Debian 12, you can use the command:
How to Delete a User from a Group in Debian 12
To delete a user from a group in Debian 12, use the following command:
Conclusion
Creating and managing your user accounts on Debian 12 is useful for protecting the privacy of your data or other important applications. You can add a user in Debian 12 directly from the terminal using the adduser command or from GUI. Besides that, you can also add users to a specific group so that they will be able to perform similar responsibilities. Further, you can delete users from the system or a group using the deluser command; the complete guide for all the methods is provided in the above sections of this article. These methods will help you create users on Debian 12 and manage them wisely.