Challenge - 5 Problems
User Management Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate2:00remaining
What is the output of the useradd command with -m option?
You run the command
sudo useradd -m alice on a Linux system. What does the -m option do?Attempts:
2 left
💡 Hint
Think about what a home directory means for a user.
✗ Incorrect
The
-m option tells useradd to create the user's home directory if it does not exist. Without it, the user is created but no home directory is made.💻 Command Output
intermediate2:00remaining
What happens when you run userdel without -r?
You run
sudo userdel bob on a Linux system. What happens to bob's home directory?Attempts:
2 left
💡 Hint
Think about what the -r option does in userdel.
✗ Incorrect
Without the
-r option, userdel removes the user account but leaves the home directory and files intact.🔧 Debug
advanced2:00remaining
Why does this useradd command fail?
You run
sudo useradd -d /custom/home charlie but get an error. What is the likely cause?Linux CLI
sudo useradd -d /custom/home charlie
Attempts:
2 left
💡 Hint
Check if the home directory exists or if you need to create it.
✗ Incorrect
The
-d option sets a custom home directory path but does not create it unless combined with -m. If the directory does not exist, useradd fails.💻 Command Output
advanced2:00remaining
What is the effect of userdel with -r option?
You run
sudo userdel -r diana. What happens?Attempts:
2 left
💡 Hint
The -r option means remove files related to the user.
✗ Incorrect
The
-r option removes the user account and deletes the home directory and mail spool files.🚀 Application
expert3:00remaining
Script to add multiple users with home directories
You want to create a script that adds users named user1, user2, and user3, each with their own home directory. Which script snippet correctly does this?
Linux CLI
#!/bin/bash for username in user1 user2 user3; do # Add user with home directory done
Attempts:
2 left
💡 Hint
Remember the correct order and syntax of options for useradd.
✗ Incorrect
The correct syntax is
useradd -m username. Option A uses this syntax correctly inside the loop.