Lpic 1 Linux Administrator · Free Practice Question Medium

Question 17

You want to add user carol to the group john while preserving her memberships in other groups. You attempt this with the command usermod carol -G john, but find that carol's existing secondary groups have been removed. What is the reason for this issue?
  • A The -G option in usermod command only allows a user to be part of one secondary group at a time.
  • B The groupmod command should be used instead of usermod to modify user group memberships.
  • C The -a option must be used with -G in the usermod command to append a group to the existing list of secondary groups.
  • D john is the primary group of another user and can only be added using the -g option.
Reveal correct answer

Correct answer: C

A. The -G option in the usermod command actually allows a user to be part of multiple secondary groups at the same time. Therefore, the issue is not related to the limitation of the -G option.

B. While the groupmod command can be used to modify group properties, the usermod command is the correct tool for modifying user group memberships. The issue is not related to using the wrong command.

C. The reason for the issue is that the -a option must be used with the -G option in the usermod command to append a group to the existing list of secondary groups. Without the -a option, the existing secondary groups are replaced with the new group specified.

D. The issue is not related to the primary group of another user. The -g option in the usermod command is used to specify the primary group of a user, not to add a user to a secondary group.

Discussion

Think the marked answer is wrong, or have a better explanation? Share it below — comments appear after review.

You must be logged in to post a comment.

Preparing For

Your Certification?

255+ certifications
Detailed explanations
Free PDF samples

Has All The Questions You Need