Skip to content

Linux Exercise 1 - User and Group Management

📝 Linux Exercise: User and Group Management

🎯 Objective

Students will practice creating and managing users and groups in Linux.
They will document (protocol) every command they executed and the output they received.


🔨 Task Instructions

1. Create two new users

  • Create a user alice with a home directory.
  • Create a user bob with a home directory.
  • Set a password for both users.

💡 Commands to use: useradd, passwd


2. Create a new group

  • Create a group called students.

💡 Command to use: groupadd


3. Add users to groups

  • Add both alice and bob to the students group as supplementary members.
  • Change alice’s primary group to students.

💡 Commands to use: usermod -aG, usermod -g


4. Check group memberships

  • Show which groups alice belongs to.
  • Show which groups bob belongs to.

💡 Commands to use: groups, id


5. Modify a user account

  • Rename bob to robert.
  • Change robert’s home directory to /home/robert_home.

💡 Command to use: usermod


6. Delete a user

  • Delete alice completely, including her home directory.

💡 Command to use: userdel -r


7. Delete a group

  • Delete the students group.

💡 Command to use: groupdel


📑 Protocol (What to Hand In)

Each student should keep a protocol (log file or document) with:

  • Every command they typed.
  • The output they received.
  • A short explanation (1–2 sentences) of what the command did.

Example format:

Command: sudo useradd -m alice
Output: (no output)
Explanation: Created user 'alice' with a home directory at /home/alice.

✅ Completion Criteria

  • All required users and groups were created, modified, and deleted.
  • Protocol includes all commands, outputs, and explanations.
  • Student can demonstrate understanding of primary group vs supplementary groups.