Linux System Administrator Exam: Assigning a User to its Primary Group

Assigning a User to its Primary Group

Question

Which of the following files assigns a user to its primary group?

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D. E.

D

The file that assigns a user to its primary group is the /etc/passwd file, option D.

This file contains the user account information, including the username, encrypted password, user ID (UID), group ID (GID), home directory, and login shell. The GID listed in this file is the primary group ID for the user.

The /etc/group file, option C, contains information about user groups, including the group name, group password (if set), and a list of usernames that belong to that group. It does not assign users to their primary group.

The /etc/pgroup and /etc/gshadow files are not standard system files in most Linux distributions. /etc/pgroup does not exist, and /etc/gshadow is a shadowed version of the /etc/group file, containing group passwords and other security-related information.

Finally, the /etc/shadow file, option B, contains the encrypted passwords for all system users. It is used to store the user password in a secure way, but it does not assign users to their primary group.

In conclusion, the correct answer is option D, /etc/passwd.