This page will show you how to create and delete users.
Note: Make sure to enable root and superusers before you proceed to avoid any errors.
This section will show you how to create a user. We will be creating three users: yourself, John Doe and Will Smith.
1. Make sure your account is a sudoer or use a root account to perform sudo command.
2. Then use the following command:
sudo adduser aidel
3. Insert your password. In my case, I use aidel as the password.
4. Then, insert the details of the user such as full name, group and phone number.
5. The system will ask whether the information is correct or not. If yes, then press Enter.
Add user aidel to sudo group using
sudo adduser username sudo
Note: This method may not work in Debian, you can use this method instead.
1. Type the following command:
sudo adduser jdoe
2. Then, insert the password. In this case, I inserted sysadmin#1 as the password.
3. The, insert the details of the user such as full name, group and phone number.
4. Press Enter if all is done.
1. Type the following command:
sudo adduser wsmith
2. Then, insert the password. In this case, I inserted sysadmin#2 as the password.
3. The, insert the details of the user such as full name, group and phone number.
4. Press Enter if all is done.
1. Type the following command:
cat /etc/passwd
2. It will show the name and details of the users.
This section will show you how to delete users.
1. Type the following command to delete user.
sudo userdel username
2. In this case, we type the following command to delete user aidel
sudo userdel aidel
3. Type the following to check again the list of users.
cat /etc/passwd
Notice that the user aidel no longer exists.
Recursively removes the user’s home directory and mail spool.
sudo userdel -r username
Forces the removal of the user account, kills processes, and deletes files.
sudo userdel -f username
Locks the user's account to ensure no one logs in during the process before deletion.
passwd -l username
You have learned how to create and delete users! Click this link to further know how to manage user accounts.