Bob Beers wrote:
> grep <group_name>: /etc/group | cut -d: -f4
>
> will give a comma separated list, provided <group_name> is a valid group name.
>
>   
There is one problem with this approach, which is the assumption that
all users' primary group is the same as their login id - which I agree
is typically the RHEL way, but it doesn't have to be the case.  If
however you have users with their primary group set to something other
than the login id - e.g. "admin" or "marketing" - then you need to look
in the /etc/passwd file as well because these users don't appear in the
comma separated list outlined above.  To check the /etc/passwd file, you
have to determine the group id value, and then scan the /etc/passwd file
looking for that value in column 4.  This will give you a list of users
whose primary group is the group value you're interested in.

Cheers,

Ian

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos

Reply via email to