CompTIA Linux+ (XK0-004) — Question 306
A junior Linux administrator receives a request to add a user, Ann, to the secondary group `cashiers`. Ann is also a member of the secondary group, `managers`.
The administrator issues the following command:
usermod -G cashiers Ann
Later, Ann reports that she is unable to access any of the files or directories in `managers`.
Which of the following commands should the administrator issue to resolve Ann's group memberships?
Answer options
- A. usermod -G cashiers,managers Ann
- B. usermod -g cashiers,managers Ann
- C. groupmod -G Ann cashiers,managers
- D. groupmod -ga Ann cashiers,managers
Correct answer: A
Explanation
The command 'usermod -G cashiers,managers Ann' (option A) is correct because it allows Ann to be a member of both the `cashiers` and `managers` groups simultaneously. Option B is incorrect as it uses the lowercase '-g', which sets the primary group instead of the secondary groups. Options C and D are erroneous because they incorrectly use the groupmod command, which is not intended for modifying user group memberships.