Courseiva
User and Group Management →mediumMultiple Choice

LFCS User and Group Management Practice Question

A temporary contractor 'contractor1' has left the company. The administrator needs to remove the user account and all associated files in the home directory. Which command accomplishes this?

⚠ Common exam trap

Test-takers frequently choose Option A, thinking `userdel` alone removes everything, or Option D, assuming `deluser` is universally available, when the LFCS exam tests the standard `userdel -r` command that works across all major Linux distributions.

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

✓

userdel -r contractor1

The `userdel -r contractor1` command removes the user account and, with the `-r` flag, also deletes the user's home directory and mail spool. This is the standard Linux command to completely remove a user and their associated files, as required by the scenario.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✗

    userdel contractor1

    Why it's wrong here

    userdel removes the account entry but leaves the home directory intact unless the -r flag is added, so contractor1's files would remain on disk. It is the right tool when the account should go while files are retained for auditing or transfer.

  • ✗

    passwd -d contractor1

    Why it's wrong here

    passwd -d deletes the account's password, leaving the account and its home directory fully present and loginable without authentication. It is used to blank a password for passwordless logins, not to remove a departing contractor's account or files.

  • ✓

    userdel -r contractor1

    Why this is correct

    `userdel -r contractor1` deletes the account and recursively removes the home directory with its mail spool, satisfying the requirement to erase all associated files. Plain `userdel` would leave `/home/contractor1` intact, so the `-r` flag is essential here.

  • ✗

    deluser --remove-home contractor1

    Why it's wrong here

    deluser --remove-home is Debian and Ubuntu specific; on RHEL-based systems the command does not exist, so it fails on the exam's target platform. It correctly deletes the account and home directory where the Debian toolset is installed.

About these practice questions

This LFCS question is part of Courseiva's 406-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 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.