Fred Stluka on 12 Nov 2011 15:41:35 -0800


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

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


JP,

Of course, the flip side is that other users in group15 will have
perms they don't need.  I don't really care too much for this
purpose, but usually that would matter.  So maybe this question is
less useful than I thought at first and yet-another-group really
is the best answer.
Yeah, I'd think you usually want to create a new group unless
there's an existing group that really does serve the same purpose.
Otherwise, you end up with one group serving 2 purposes, which
may diverge in the future, and then you'd have a mess.  Also, as
you said, it will often matter that extra people are in the group
when they don't need to be.  So, I think the only time you'll
really use this script will be to find out whether there is
already a group for this purpose.

How often do you have to do this, that chaining greps as an ad hoc
on-the-fly solution isn't good enough?  Sounds like you've inherited
a system with a ton of groups with non-obvious names.  Bummer!

--Fred
---------------------------------------------------------------------
Fred Stluka -- mailto:fred@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.
---------------------------------------------------------------------


On 11/12/11 2:38 PM, JP Vossen wrote:
On 11/12/2011 02:30 PM, David Coulson wrote:
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.

Since this is a Linux system, the primary group is the same as the user name, so that's no help.

I'd forgotten about the 'id' command, thanks for the reminder. But I'm not sure I see how that helps me; it seems like I'd still need to parse stuff into some kind of data structure so I can get my answer.

Maybe I need an example.

If I have user01 to user10 (decimal, not binary :), and group01 to group40, I want to know that, say, group15 contains 8 out of 10 of my users, so if I can add user09 and user10 to group15, everyone will have the right perms once I chgrp the dir tree.

Of course, the flip side is that other users in group15 will have perms they don't need. I don't really care too much for this purpose, but usually that would matter. So maybe this question is less useful than I thought at first and yet-another-group really is the best answer.

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