hardMultiple Choice
220-1202 Practice Question: A system administrator needs to change the group…
A system administrator needs to change the group ownership of a directory /srv/data and all its contents to 'datagroup'. Which command will accomplish this recursively?
⚠ Common exam trap
Candidates often confuse `chgrp` with `chown` or `chmod`, mistakenly thinking that `chown datagroup:` or `chmod -R g+rw` will change group ownership, when in fact they change user ownership or permissions, respectively.
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
✓
chgrp -R datagroup /srv/data
The correct command is `chgrp -R datagroup /srv/data`. The `-R` (or `--recursive`) flag tells `chgrp` to operate on the directory and all its contents, changing the group ownership to 'datagroup'. This directly fulfills the requirement to change group ownership recursively.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
chgrp -R datagroup /srv/data
Why this is correct
The -R flag applies the ownership change recursively, so chgrp descends through /srv/data and alters the group of every file and subdirectory to datagroup. Without -R, only the directory itself would change, leaving its contents untouched and failing the recursive requirement.
- ✗
chown datagroup: /srv/data
Why it's wrong here
chown datagroup: sets the group but omits -R, so only /srv/data itself changes and its contents retain the old group. It is tempting because the syntax correctly names the group, and it would be right for a single non-recursive target rather than a directory tree.
- ✗
chmod -R g+rw /srv/data
Why it's wrong here
chmod -R g+rw alters permission bits on files and directories; it does not change which group owns them, so ownership remains unchanged. It is tempting because -R recurses correctly, and it would be right for granting the existing group read and write access.
- ✗
groupmod -R datagroup /srv/data
Why it's wrong here
groupmod modifies a group's own attributes, such as its name or GID; it has no -R option and never changes file ownership. It is tempting because 'group' appears in the command name, but it would be correct when renaming the datagroup group itself.
Go deeper
Related to this question
About these practice questions
Courseiva writes every 220-1202 question from scratch — 687 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 by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This 220-1202 practice question is part of Courseiva's free CompTIA 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 220-1202 exam.