Courseiva
User and Group ManagementeasyMultiple ChoiceObjective-mapped

LFCS User and Group Management Practice Question

A system administrator needs to create a user 'john' with a home directory in /data/users and an expiry date of 2025-12-31. Which command accomplishes this?

⚠ Common exam trap

Many candidates confuse `-c` (comment) with `-e` (expiry) or assume `adduser` supports the same long options as `useradd`, leading them to pick A or B, while D is tempting because it includes `-m` but misses the required `-d` to specify the custom path.

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 -d /data/users -e 2025-12-31 john

The `useradd` command with `-d /data/users` sets the home directory to the specified path, and `-e 2025-12-31` sets the account expiry date in YYYY-MM-DD format. The `-e` flag directly corresponds to the `EXPIRE_DATE` field in `/etc/shadow`, which controls when the account becomes locked.

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 -d /data/users -c 2025-12-31 john

    Why it's wrong here

    -c sets the GECOS comment, not expiry.

  • adduser --home /data/users --expiredate 2025-12-31 john

    Why it's wrong here

    adduser is distribution-specific and interactive; not the standard command.

  • useradd -d /data/users -e 2025-12-31 john

    Why this is correct

    Correctly sets home directory and expiry.

  • useradd -m -e 2025-12-31 john

    Why it's wrong here

    -m creates the home directory in /home/john by default, not /data/users.

About these practice questions

One of 507 original LFCS practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. 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 LFCS practice question is part of Courseiva's free Linux Foundation 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 LFCS exam.