LFCS Essential Commands Practice Question
An administrator needs to change the ownership of the directory /srv/www to user webadmin and group webteam, including all existing files and subdirectories. Which command accomplishes this?
⚠ Common exam trap
It's easy for candidates to confuse chown with chmod, assuming that a permission command can also set ownership, or forgetting that recursive changes require the -R option.
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
✓
chown -R webadmin:webteam /srv/www
The chown command changes file ownership, and the -R flag applies the change recursively. Specifying both user and group as webadmin:webteam in one invocation sets the owner and group for the directory and everything beneath it. This is the standard, efficient way to recursively reassign ownership for a web directory.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
chown -R webadmin:webteam /srv/www
Why this is correct
The chown command changes file owner and group. The -R option applies the change recursively to all files and subdirectories under /srv/www. Specifying webadmin:webteam sets both the user and group in a single command, which exactly meets the requirement without needing a separate chgrp invocation.
- ✗
chmod -R webadmin:webteam /srv/www
Why it's wrong here
chmod modifies permission bits (read, write, execute) and does not accept user or group names as arguments. Using chmod with webadmin:webteam would produce a syntax error or be misinterpreted as an octal value. It cannot change ownership, so it fails to accomplish the required task.
- ✗
usermod -R webadmin:webteam /srv/www
Why it's wrong here
usermod modifies user account properties such as login name, home directory, or group membership. It does not operate on filesystem paths and has no -R option for recursive file ownership changes. This command would either fail or modify the wrong system component, not change directory ownership.
- ✗
chown webadmin:webteam /srv/www
Why it's wrong here
Without the -R option, chown changes ownership only of the directory /srv/www itself, leaving existing files and subdirectories unchanged. The administrator explicitly needs to include all existing files and subdirectories, so this command is incomplete and would leave many items with the old ownership.
Go deeper
Related to this question
About these practice questions
Courseiva writes every LFCS question from scratch — 406 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
JA
Written and reviewed by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
Last reviewed September 2026 · checked against the official Linux Foundation exam blueprint
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.