Which command adds an existing user to a specified group?

Prepare for the Red Hat Certified Systems Admin Exam EX200. Enhance your skills with interactive quizzes, flashcards, and detailed explanations. Ace your certification exam today!

Multiple Choice

Which command adds an existing user to a specified group?

Explanation:
Modifying a user's group membership is what this is testing. Using the user management tool to assign a group directly attaches the user to that specified group. The command does this by listing the group with -G and naming the user, which is the straightforward way to grant access associated with that group. Keep in mind that -G sets the user’s supplementary groups to exactly the ones you specify; if you want to preserve any existing supplementary groups while adding a new one, you would use the append form: -aG. That nuance is important for real-world administration. Other options either use a different tool or target a different aspect of grouping: gpasswd -a also adds a user to a group but is a separate utility; adduser is typically for creating users; and setting the primary group with -g would change the main group, not merely add to the specified group.

Modifying a user's group membership is what this is testing. Using the user management tool to assign a group directly attaches the user to that specified group. The command does this by listing the group with -G and naming the user, which is the straightforward way to grant access associated with that group.

Keep in mind that -G sets the user’s supplementary groups to exactly the ones you specify; if you want to preserve any existing supplementary groups while adding a new one, you would use the append form: -aG. That nuance is important for real-world administration.

Other options either use a different tool or target a different aspect of grouping: gpasswd -a also adds a user to a group but is a separate utility; adduser is typically for creating users; and setting the primary group with -g would change the main group, not merely add to the specified group.

Subscribe

Get the latest from Passetra

You can unsubscribe at any time. Read our privacy policy