The user's account management in which adding and removing a user from the Linux system is included in the responsibilities of the Linux administrator. Administrators can perform this job using both ways either using the command line or using the graphical environment.
Here at LinuxAPT, as part of our Server Management Services, we regularly help our Customers to perform related Linux Systems queries.
In this context, we shall look into the procedure of adding and removing a user from the Debian 10 system.
To add or remove a user from the Debian system, the user needs administrative or sudo privileges.
Open the terminal using the start menu of your Debian system. Use the below-mentioned syntax to add a user to your system:
$ sudo adduser UserName
For example, from adding the new user 'linuxAPT' on the Debian system, the above command will apply into the following form:
$ sudo adduser linuxAPT
On the execution of the above-mentioned command, you will be asked to enter the sudo password. Enter 'sudo' account password and then hit 'Enter'. Enter the new password for the new user and for confirmation, re-type the password again. The message will show on the terminal window that 'password' is updated successfully. Now, enter the remaining necessary information of the user such as the user's full name, room number, phone details, etc. after that, confirm these details by pressing the 'y' if all information is correct and then press 'Enter'.
The new user is now created on Debian 10 system. For verification, access the Debian 10 user's management section.
To add a new GUI, click on the Debian start menu and choose the setting icon from the displaying items list.
Now, type 'users' in the search bar. The user's section will show on the desktop.
Click on the 'Unlock' to add a new user.
An authentication dialog will display on the desktop window. Type the administrator password for the authentication and click on the 'authenticate' button.
Now, click on the 'Add user' button to add a new user to the Debian 10 system.
Enter the required information for adding a new user on the displaying the dialog such as the account type, users full name, password, etc. After giving the all information, click on the 'Add' option.
You will see on the displaying window that the user is added to your system successfully.
To remove a user through the terminal, use the below-given syntax:
$ sudo deluser {username}
Enter the user name that you want to remove from the system. For example, to remove a user 'linuxAPT' from the Debian system:
$ sudo deluser linuxAPT
For removing a user along with the user's directory then, type the below-mentioned command:
$ sudo deluser --remove-home username
To remove the user along with all associated files then, use the below-given command:
$ sudo deluser --remove-all-files username
Change the user name with your own name of the user that wants to remove.
To remove a user from your Debian system, click on the 'settings' icon.
Type 'users' in the search bar to search the user's section. The user's window should display on the desktop.
Click on the 'Unlock' button to remove a user.
Enter the sudo or administrative login account password to authenticate the user and then choose the 'authenticate' button.
Now, choose the user that you want to remove from the Debian system and then click on the 'Remove user' button to remove this user.
If you want to remove all associated files with this user then, click on the 'Delete files' button to remove the user.
This article covers how you can easily remove or add a new user to your Debian 10 system. One of the most basic tasks that you should know how to do on a fresh Linux server is add and remove users.
In order to add and delete users on Debian, you need to have sudo rights, or to belong to the sudo group.
To check your sudo rights, run the following command:
$ sudo -v
If no error messages appear, you are good to go, otherwise ask your system administrator to provide you with sudo rights.
How to add a user using useradd ?
Run the following command:
$ sudo useradd
To assign a password to the user, you can use the -p flag but it is not recommended as other users will be able to see the password.
To assign a password to a user, use the passwd command:
$ sudo passwd