0

I'm following a course about Linux and it states the following: "The primary group of a user is not mentioned in the /etc/group file."

However, my primary user "timgeldof" actually does show up in the /etc/group file. I have verified that the user indeed has "timgeldof" as primary group using the id and the groups command.

The rule stated in my course does apply for every other user though. Does it matter that the user timgeldof is the first user I created during installation?

  • you'd have to squint just the right way to interpret it correctly, perhaps as "the primary group of a user is not dictated by /etc/group, but by /etc/passwd (or the equivalent user database)" – Jeff Schaller Jan 9 at 17:36
3

The rule isn’t quite accurate; it should say

  • on systems using /etc/passwd and /etc/group, the primary group of a user is defined in /etc/group (this determines its identifier);
  • a user doesn’t need to be listed as a member of his/her primary group.

As stated (in your question and in the version above), this doesn’t forbid your user appearing as a member of your primary group in /etc/group, because the primary group is defined in the user entry, not as a result of group membership.

At least on Linux, when you log in, your group memberships are initialised as follows:

  • your primary group is set to match your defined primary group (from /etc/passwd or wherever your user information is stored);
  • your additional groups are set up to match the groups you’re a member of, and your primary group.

Thus it doesn’t matter whether your primary group lists you as a member or not.

Incidentally, it appears that, as you mention, the user created during installation is listed as a member of his/her primary group, on Fedora and presumably other distributions using Anaconda.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.