Frequently Asked Question
What does the /etc/group file actually do?
/etc/group defines every group on the system and lists which users belong to each
one. A line like sudo:x:27:chris,alice says: there is a group called sudo, its
GID is 27, the placeholder x means the (largely unused) group password lives in
/etc/gshadow, and the members are chris and alice. The file is world-readable
for the same reason /etc/passwd is: tools need to map GIDs to names.
A user's primary group comes from the GID field of /etc/passwd and does not need
to be listed in /etc/group, that is the group new files inherit by default. All
the other groups they belong to are supplementary and are listed in /etc/group.
Running id shows both; running groups shows the names. Linux supports up to
NGROUPS_MAX supplementary groups (65 536 on modern kernels), so there is no
meaningful limit in practice.