easyMultiple ChoiceObjective-mapped
XK0-006 Practice Question: A system administrator needs to create a new user…
A system administrator needs to create a new user account with a home directory and the bash shell. Which command should be used?
⚠ Common exam trap
Many candidates confuse the `-d` flag (which only sets the home directory path in `/etc/passwd`) with the `-m` flag (which actually creates the directory), leading them to choose option C instead of D.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
useradd -m -s /bin/bash user
The `-m` flag tells `useradd` to create the user's home directory if it does not already exist, and `-s /bin/bash` sets the login shell to bash. This meets the requirement of creating a new user with a home directory and the bash shell.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
useradd -r -s /bin/bash user
Why it's wrong here
The -r option creates a system account, typically without a home directory.
- ✗
useradd -c -s /bin/bash user
Why it's wrong here
The -c option sets a comment field, not the shell.
- ✗
useradd -d /home/user -s /bin/bash user
Why it's wrong here
The -d option sets home directory path but does not create it; -m is needed to create the directory.
- ✓
useradd -m -s /bin/bash user
Why this is correct
Correct: -m creates home directory, -s sets shell to /bin/bash.
Go deeper
Related to this question
Learn chapter
User and Group Administration
Key term
Shell
A shell is a computer program that provides a user interface to access an operating system's services, typically by accepting text commands.
Key term
User
A user is any person, system, or device that interacts with an IT service, resource, or identity system, typically authenticated through credentials and authorized to perform specific actions.
About these practice questions
This XK0-006 question is part of Courseiva's 979-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This XK0-006 practice question is part of Courseiva's free CompTIA certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the XK0-006 exam.