I added a few users to the users group "test1" "test2" and "test3" and set their primary group to users using following:
Code:
# usermod -g users test1
# usermod -g users test2
# usermod -g users test3
I then decided to create a new group and just add one user to it:
Code:
# groupadd gamers
# usermod -a -G gamers test1
Using groupmems, I checked to see who had gamers as their primary group:
Code:
# groupmems -l -g gamers
test1
I'm confused here because groupmems is supposed to show primary group memberships, so why is test1 showing, it should return nothing (I'm also confused on the syntax as groupmems --help indicates that the usage should be
groupmems -g groupname -l...
Here is the result of users group:
Code:
# groupmems -l -g users
test1 test2 test3
So test1 has two primary groups?
So I checked /etc/passwd
Code:
# more /etc/passwd | grep test1
test1:x:1001:100::/home/test1:/bin/bash
And it shows that the gid is 100 (users) which is in fact the primary group...
So which is right, groupmems or /etc/passwd, or does /etc/passwd simply showing the "first assigned" primary group vice the primary group? In any case how can a user have more than one primary group?
Please help me understand.
SK