Linux Administration
medium
Questão de Linux Administration #019e3987
Enunciado da Questão
Linux Administration
#passwd
#gid
#primary-group
#etc-passwd
#user-account
Médio
Which of the following files assigns a user to its primary group?
A
/etc/pgroup
B
/etc/shadow
C
/etc/group
D
/etc/passwd
Correta
E
/etc/gshadow
Explicação Oficial / Explicações da Comunidade
The /etc/passwd file is the correct file that assigns a user to its primary group. Each line in /etc/passwd represents a user account and contains seven colon-separated fields: username, password placeholder, UID, GID, comment, home directory, and login shell. The GID (group ID) field specifies the user's primary group. When a user logs in, the system uses this GID to determine the user's primary group membership.
How it Works
- The
/etc/passwdfile stores essential user account information. The fourth field (GID) is a numeric identifier that corresponds to a group defined in/etc/group. This GID defines the user's primary group. - Commands like
idandgroupsdisplay the primary group by reading the GID from/etc/passwdand mapping it to a group name via/etc/group. - The primary group is used as the default group for files created by the user and for permission checks when no supplementary groups apply.
Why Other Options Are Incorrect
/etc/pgroupdoes not exist in standard Linux systems; it is a distractor./etc/shadowstores encrypted password hashes and password aging information, not group assignments./etc/groupdefines group names, GIDs, and lists of supplementary group members. It does not assign primary groups; it only lists which users are members of each group as supplementary members./etc/gshadowstores shadow passwords for groups and group administrator information, not primary group assignments.