1

If I am not wrong, the file /etc/group shows the list of the groups and for each one are listed the users that are members as secondary group only. I created some users in order to do some test. The strange behavior is that my user is listed in my primary group. The other users don't appear in them primary groups. Do you have any idea? Here you are the example on my CentOS system:

[root@server2 ~]# id intore
uid=1000(intore) gid=1000(intore) groups=1000(intore),10(wheel)

root@server2 ~]# cat /etc/group
lisa:x:1001:
lisa_m:x:1002:
betty:x:1009:
sales:x:1007:bob,betty,linda,lisa
account:x:1008:bill,beatrix,lori,bob
bill:x:1010:
beatrix:x:1011:
linda:x:1003:
wheel:x:10:intore,lisa,lisa_m
intore:x:1000:intore
6
  • 2
    What system is this on and how did you create the users?
    – Kusalananda
    Jan 20, 2018 at 13:10
  • This looks like a very wrong group file. I hope that output from can is trimmed.
    – fugitive
    Jan 20, 2018 at 13:38
  • @Kusalananda: the system is CentOS 7, the user "intore" is the first user created during the installation process. The other users have been added by using useradd command
    – intore
    Jan 20, 2018 at 14:28
  • @fugitive: sure, that output is a part of the group file
    – intore
    Jan 20, 2018 at 14:29
  • Note that it doesn't make any practical difference. A user is in the group specified as their primary group in /etc/passwd (or, more generally, getent passwd), AND in any groups that list them in /etc/group (getent group). They may, or may not, be listed explicitly in their primary group's entry but it makes no difference to their group membership status either way.
    – cas
    Jan 21, 2018 at 5:11

1 Answer 1

2

If you add a user to a group by making the group its primary one then the user is not added to the user list in /etc/groups.

Some distros create a group for each user. It makes some sense to add the user to that group in the group file so that the user is a member even if the primary group is changed.

Of course, you could make that argument for other groups, too.

2
  • so my user intore appears because is the one I defined during the installation?
    – intore
    Jan 20, 2018 at 14:38
  • @intore That may be the reason. Perhaps this difference is not even intentional. Jan 20, 2018 at 14:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .