[CVALE] musical groups
Patrick Bennett
stnick at bennettbungalow.com
Fri Jan 25 10:58:42 PST 2008
Okay, so I'm not just missing something in the man pages about how to
specify a group as a member of another group then..... I was hoping I
was just being impatient with the man pages or there was some
under-documented way to do this built in to the group file syntax. For
example:
administrators:x:1000: joe,tina,admin
dialout:x:1001:jane,sam, at administrators
But no such luck, I take it. Seems awfully obvious to me, but oh well.
Thanks!
-Patrick
Dennis Baker wrote:
> usermod + parsing the group file plus your favorite scripting language
> + a cron job every 5 minutes?
>
> grep admin /etc/group
> parse the line pulling all users out
> usermod -name username dialout
>
> the part that's tricky is removing people from groups. you can
> certainly use usermod to remove them from the groups but if you remove
> smeone from admin are they always removed from dialout or only when
> they were added to dialout because they were in admin? You would have
> to keep that info separate.
>
> It might just be easier to write a script that adds/ removes them.
>
> grantadmin.sh
> #!/bin/bash
> usermod --name $1 -a admin,dialout
>
> unfortunately I don't know an easy way to drop someone from a group
> with usermod. The only thing I could figure is grab the groups they
> are in, drop all groups and add the groups back in one at a time
> eliminating the admin and dialout groups.
>
> The only way I've figured out to get a list of groups easily is either:
> grep username /etc/group
> then parse the result
>
> or
>
> sudo -u username groups
>
> the second result is cleaner but obviously requires sudo and privs.
>
> I'm not very good with shell scripting and generally lean on php or
> python so I'm not even going to take a stab at a script to parse those
> lines. The first you could probably use sed and xargs. The second is
> maybe easier.
>
> Sorry... more a braindump than much help.
>
>
>
> On Jan 23, 2008 7:22 PM, Patrick Bennett <stnick at bennettbungalow.com
> <mailto:stnick at bennettbungalow.com>> wrote:
>
> Does anyone know if it is possible, and if so how to do so properly
> either with the command line or editing the /etc/group file, to add
> group A to group B such that all users of group A at any given moment
> are also users of group B?
>
> For example, joe, tina, and admin belong to the group called
> "administrators", while jane and sam are members of "dialout". I want
> jan and sam to remain members of "dialout", while adding all
> members of
> "administrators" to also be members of "dialout". Furthermore, six
> months from now when diego becomes a new "adminstrator" I want him to
> automatically become a member of "dialout", and he will be replacing
> joe, so when I remove joe from "adminsitrators" I want him to be
> automatically removed from "dialout".
>
> Thus, I want the group "administrators" to be a member of the group
> "dialout". Is this possible? (I'm not interested in tricky gui tools
> to do this for me.)
>
> -Patrick
>
> _______________________________________________
> cvale mailing list
> cvale at lists.fire2wire.com <mailto:cvale at lists.fire2wire.com>
> http://lists.fire2wire.com/mailman/listinfo.cgi/cvale
>
>
>
>
> --
> Dennis Da-Ogre http://ogrehut.com
> ------------------------------------------------------------------------
>
> _______________________________________________
> cvale mailing list
> cvale at lists.fire2wire.com
> http://lists.fire2wire.com/mailman/listinfo.cgi/cvale
>
More information about the cvale
mailing list