linux - CentOS: View all users in a specific group

06
2014-04
  • slayernoah

    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?

  • Answers
  • John

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


  • Related Question

    Weird linux problem: user is in www-data group in /etc/groups but groups command doesn't show him
  • kevinz

    I've come into something strange.

    I just added a user to the www-data group, the user appears in both /etc/group and /etc/group-, however when I use the groups or id commands the group isn't listed; and the user can't chgrp a file into www-data.

    What could be the problem? I'm using a Debian testing machine, never had this kind of problem.


  • Related Answers
  • MikeyB

    Group membership is only processed on login. You can either:

    • re-login to pick up the new group
    • use newgrp www-data to run a new shell with gid set to www-data