Progress: 0/62 (0%)

👥 Adding Users to Groups

Creating and Deleting Users

Think of a Linux system as a big office building:
• Every user is like an employee who can log in, access certain rooms (files), and use office resources (programs).
• When someone new joins, you need to create a new employee account. When someone leaves, you delete their account.

1a. useradd

useradd is like the HR manager filling out a basic employee form: "Here's a new person. Give them an office and a username."

sudo useradd john

This creates a user john but doesn't create a home folder or set a password by default.

sudo useradd -m john

To create a home folder (so john has his own "desk").

sudo useradd -m -s /bin/bash john

To set a default shell (like giving the employee a preferred working tool).

1b. adduser

adduser is like a fancier HR assistant who asks for more details automatically: full name, password, phone extension.

sudo adduser john

This automatically:

  • Creates a home folder /home/john → a
  • Sets the shell to /bin/bash → b
  • Prompts for a password → c
  • Lets you fill in full name and other details → d

1c. userdel

When someone leaves the company, you need to remove their account:

sudo userdel john

By default, this removes the user account but keeps their files.

sudo userdel -r john

To remove the user and delete their home folder (desk and personal files).

Real-life analogy

useradd = fast basic signup, adduser = guided signup with forms and details.

✅ Key takeaway:
useradd = basic account creation
adduser = friendly guided creation
userdel = removing users, -r removes their personal files too