System administrators create user accounts when they have finished setting up a new machine. Removing and assigning root privileges to existing users is also part of their job.
In this article, I am going to discuss the topic of managing user accounts in Debian version 10. This includes creating a new user, changing the password, deleting a user and assigning root privileges to an existing user.
Therefore, let’s continue without wasting any further time.
How to create a new user
To create a new user, you need to open up a terminal and execute the command with root privileges having the following syntax.
adduser {username}
For instance, if you want to add user “tony” the command will have the following shape.
adduser tony
As soon as you execute the adduser command you will be prompted to add a password and other information like full name, room number, work, and home phone. You will then be prompted to press Y if you have entered the correct information.
Passwords are not visible on the terminal.
How to change the password of an existing user
If you are changing the password of an existing user, you need to have root privileges. The command has the following syntax,
passwd {username}
Suppose you want to change the password of a user “tony”, the command should have the following shape.
passwd tony
You will be prompted to enter the new password to proceed.
How to change own password
If a user wants to change his/her own password, he/she needs to execute the following command on terminal.
passwd
As soon as it is executed, you will be prompted to enter the new password.
How to delete an existing user
Again, you need to have root privileges to delete an existing user. The syntax of the complete command is as follows,
deluser {username}
Suppose you want to delete a user tony, you need to execute the following command.
deluser tony
How to assign root privileges to an existing user
An ordinary user cannot perform an administrative task. If you want to do this, you need to add an existing user to the “sudo” group. Users in sudo group have all the rights to perform an administrative task.
As a root user, execute the following command.
usermod -aG sudo {username}
Suppose you want to add the user tony to sudo group, you will have to execute the following command on terminal.
usermod -aG sudo tony
So we have completed our discussion on basic user management. These were some of the basic and handy operations that can be used for a day to day task.