Courseiva
easyMultiple Choice

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 flag supplies the GECOS comment field, not a home directory, so no home is created. It is tempting because -c is a legitimate useradd flag, correctly used when populating descriptive account data such as a full name or phone number.

  • ✗

    useradd -d /home/user -s /bin/bash user

    Why it's wrong here

    Passing -d /home/user only sets the home path; without -m, useradd records the directory but does not create it. It is tempting because -d is the right flag when relocating an account's home to a non-default path, provided -m accompanies it.

  • ✓

    useradd -m -s /bin/bash user

    Why this is correct

    The -m flag creates the home directory, satisfying that requirement, while -s /bin/bash sets bash as the login shell. Plain useradd omits both by default, so combining these flags in one invocation produces the account exactly as specified.

About these practice questions

This XK0-006 question is part of Courseiva's 781-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 →

How Courseiva writes practice questions · Editorial policy

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.