LFCS Essential Commands Practice Question
A systems administrator needs to add a new user 'jdoe' with a home directory in /export/home, a UID of 1500, and an expiry date of 2025-12-31. Which command should they use?
⚠ Common exam trap
Many candidates confuse the `-c` (comment) option with `-e` (expiry) and assuming `-b` (base directory) works the same as `-d` (explicit home directory), leading candidates to pick options that set the wrong field or fail to place the home directory in the specified 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 -u 1500 -d /export/home/jdoe -e 2025-12-31 jdoe
The `useradd` command with `-u 1500` sets the UID, `-d /export/home/jdoe` explicitly specifies the home directory path (without creating it unless `-m` is also used), and `-e 2025-12-31` sets the account expiry date in YYYY-MM-DD format. This matches all requirements: UID 1500, home directory at /export/home/jdoe, and expiry on 2025-12-31.
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 -u 1500 -d /export/home/jdoe -e 2025-12-31 jdoe
Why this is correct
useradd accepts -u for the UID, -d for the home directory path and -e for the account expiry date, so all three constraints are set in one invocation. The path must be given explicitly since /export/home is not the default parent.
- ✗
useradd -u 1500 -d /export/home/jdoe -c 2025-12-31 jdoe
Why it's wrong here
The -c flag sets the GECOS comment field, so 2025-12-31 becomes jdoe's description rather than an account expiry; -e is the expiry flag. It is tempting because -c and -e look similar and both accept a date-like string, but -c is for the comment field only.
- ✗
useradd -u 1500 -m -e 2025-12-31 jdoe
Why it's wrong here
The -m flag creates a home directory using the default base path from /etc/default/useradd, not /export/home, so jdoe's home lands in /home. It is tempting because -m is the standard way to request home directory creation, and it would be correct once -b /export/home sets the base.
- ✗
useradd -u 1500 -b /export/home -e 2025-12-31 jdoe
Why it's wrong here
The -b flag only sets the base directory for future accounts; without -m, no home directory is created for jdoe, so the requirement fails. It is tempting because -b correctly names /export/home, and it would be the right choice when combined with -m to create the directory.
Go deeper
Related to this question
About these practice questions
One of 406 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 →
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.