What command is used to add a user to a specific group?

Prepare for the Linux Professional Institute Certification Level 1. Use flashcards and multiple choice questions, complete with hints and explanations. Enhance your understanding and get ready to ace the exam!

The command used to add a user to a specific group is correctly identified as "usermod -aG groupname username."

The option "usermod -aG groupname username" does two important things: it modifies an existing user account and appends the specified group to the user's existing group memberships. The "-a" flag stands for "append," and it ensures that the user retains their current group memberships while being added to the new group specified by "groupname." This is crucial because without the "-a" flag, the user would be removed from all groups not listed in the command, which is generally not the desired outcome when adding a user to a group.

This command is widely used in managing user permissions and roles within a Linux system, as groups are essential for organizing users and controlling access permissions to files and resources on the system. By adding a user to specific groups, administrators can efficiently manage access without creating complexities in individual user permissions.

The other options do not accurately reflect the proper command for adding a user to a specific group or might not function as intended. For example, "usermod -G groupname username" would replace all existing groups for the user with the new group rather than appending it.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy