Courseiva
Manage users and groupsmediumMultiple ChoiceObjective-mapped

EX200 Manage users and groups Practice Question

A system administrator needs to change the primary group of an existing user to a group that already exists. Which command should be used?

⚠ Common exam trap

It's easy for candidates to confuse the `-g` (primary group) and `-G` (supplementary groups) options of `usermod`, leading candidates to pick option D when they need to change the primary 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

usermod -g existinggroup username

The `usermod -g` command changes the primary group of an existing user to a specified group that already exists on the system. The `-g` option sets the initial login group (GID) for the user, which must be a valid group name or GID from `/etc/group`.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • groupmod -g existinggroup username

    Why it's wrong here

    The `groupmod` command is designed to modify attributes of a group, not of a user, and its `-g` option changes the group's GID. The operands for `groupmod` are group names, not usernames, so passing a username as the second argument is syntactically invalid. The correct tool to alter a user's primary group is `usermod -g`, which operates on the user account credentials.

  • usermod -g existinggroup username

    Why this is correct

    This is correct because `usermod -g` directly modifies the user's primary group by changing the GID field in the `/etc/passwd` entry. The specified group must already exist on the system, otherwise `usermod` will return an error and make no changes. After this command, newly created files and directories will inherit this group as their owning group by default, until the user changes it.

  • usermod -p existinggroup username

    Why it's wrong here

    The `-p` option in `usermod` is used to set the user's encrypted password, not to assign a primary group. It expects a password hash string as an argument; passing a group name here would be treated as an invalid hash, potentially breaking authentication. The correct option for changing the primary group is `-g`, which updates the GID field in /etc/passwd.

  • usermod -G existinggroup username

    Why it's wrong here

    The `-G` option in `usermod` updates the list of supplementary groups the user belongs to, which is stored in /etc/group. It does not affect the user's primary group, which remains defined by the GID field in /etc/passwd. To change the primary (initial) group, the administrator must use the lowercase `-g` flag instead, as supplementary and primary groups are managed independently.

About these practice questions

One of 127 original EX200 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 →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This EX200 practice question is part of Courseiva's free Red Hat 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 EX200 exam.