6

I added a user user01 to a group group01 using: usermod -a -G group01 user01

When I run in command id user01 it shows that this user has actually been added to the group.

However, the file /etc/group doesn't reflect this. i.e. I believe that on this file, users that belong to each of the groups should be listed next to it. Please correct me if I am wrong.

This is a fresh installation of CentOS 6.4

Also, since id user01 shows that this is updated, is there any way to check all the members of group group01?

thilina R
  • 2,973
  • 5
  • 28
  • 36

2 Answers2

9

If you run getent group group01 you should see a list of all members of that group.

John
  • 1,433
1

/etc/group is a source of group information, but not necessarily the only one. If your system is set up to use NIS, LDAP, or some other source of user/group information, that information will not necessarily be reflected in /etc/group.

getent reads and reports from all of the configured data sources, of which /etc/group is only one. I specifically use getent because I use local password/group information in conjunction with a remote LDAP source (configured with PAM modules) and wanted to have consolidated information.

Also, /etc/group is not updated automatically based on external authentication sources. It is updated directly, either using an editor (such as vi, emacs, etc) or by tools for modifying user/group information (groupadd, useradd, etc).

jAce
  • 1,382
  • 6
  • 17
  • 32