LFCS Essential Commands Practice Question
A system administrator needs to change the ownership of the file /var/www/html/index.html from user alice to user bob, and also change the group to webdev. Which command should they use?
⚠ Common exam trap
It's easy for candidates to confuse chmod with chown, or thinking chgrp can change both owner and group when it only affects the group.
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 bob:webdev /var/www/html/index.html
The chown command is specifically designed to change file owner and group. Using the colon-separated syntax user:group sets both in one step. chmod deals with permissions, chgrp only changes group, and usermod manages user accounts. Thus, chown with bob:webdev is the correct and efficient solution.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
chmod bob:webdev /var/www/html/index.html
Why it's wrong here
chmod is used to change file mode bits (permissions), not ownership. The syntax bob:webdev is invalid for chmod and would produce an error. This command cannot change owner or group, so it fails to meet the requirement.
- ✗
usermod -o bob:webdev /var/www/html/index.html
Why it's wrong here
usermod modifies user account properties, not file ownership. The -o option allows non-unique UIDs, and the syntax here is completely wrong. This command would attempt to modify a user named bob with invalid arguments, failing to change file ownership.
- ✗
chgrp bob:webdev /var/www/html/index.html
Why it's wrong here
chgrp changes only the group ownership of a file. It does not change the user owner, and the syntax bob:webdev is not valid for chgrp because it expects a group name followed by file names. This would not set the owner to bob.
- ✓
chown bob:webdev /var/www/html/index.html
Why this is correct
The chown command changes file owner and group. Using the syntax user:group, it sets the owner to bob and the group to webdev in a single operation. This exactly matches the requirement without affecting other metadata like permissions.
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 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.