What's the command to figure out who the members are of a *nix group?
|
|
depending on the environment, for secondary groups here are some options.: "getent group | grep ^groupname:" (getent - get entries from administrative database) "ypcat group | grep ^groupname:" (ypcat - print values of all keys in a NIS database) "grep ^groupname: /etc/group" (/etc/group is the local group file) and if you just want the name of the group and the users add "| cut -d: -f1,4" to the end of the string (example: grep ^groupname: /etc/group | cut -d: -f1,4) The primary group id is listed in the passwd file entry for each user, so the user's primary groups won't show up in the output of any of the commands listed above. You could "grep ^groupname: /etc/group | cut -d: -f1,3" to get the groupid number, then "grep :groupidnumber: /etc/passwd | cut -d: -f1" to get the user's account name. |
|||
|