David Coulson on 12 Nov 2011 11:31:07 -0800


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] Finding a /etc/group entry containing a user list


Just run 'id' against each username and parse out the output. Remember /etc/group is typically just for supplemental groups - The user's primary group is usually only in /etc/passwd.

On 11/12/11 2:27 PM, JP Vossen wrote:
I have a list of 10 users and I'd like to see if there is an entry in /etc/group that already contains all or most of them. Unfortunately, the /etc/group file is large, not well maintained, and not sorted in any way at all. If there is not a group that contains all the users, I'd like a list of the groups that contain the most because I may be able to just add the missing ones.

I thought of chaining a bunch of greps together, but that's ugly, not scalable, and won't give me a list of partial matches.

I know I could write some Perl (or whatever) code to do this, but does anyone have a better trick?

Thanks,
JP
----------------------------|:::======|-------------------------------
JP Vossen, CISSP            |:::======|      http://bashcookbook.com/
My Account, My Opinions     |=========|      http://www.jpsdomain.org/
----------------------------|=========|-------------------------------
"Microsoft Tax" = the additional hardware & yearly fees for the add-on
software required to protect Windows from its own poorly designed and
implemented self, while the overhead incidentally flattens Moore's Law.
___________________________________________________________________________ Philadelphia Linux Users Group -- http://www.phillylinux.org Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce General Discussion -- http://lists.phillylinux.org/mailman/listinfo/plug
___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug