HOPE Bill wrote:
> Hi,
> I'm either not understanding (probable) or I cannot find how to change
> the group membership of the current executable such that files created
> by the process have the group ownership I need.
>
> setpgrp() doesn't seem to be it.
>
> Ideally, it would work on Windows also. Unix is assumed.
>
> Can anyone point me to the proper reference?
Check out the POSIX.pm/POSIX.pod for setgid/getegid/setrgid.
From perlvar man page:
...
$REAL_GROUP_ID
$GID
$( The real gid of this process. If you are on a machine that supports
membership in multiple groups simultaneously, gives a space
separated list of groups you are in. The first number is the one
returned by getgid(), and the subsequent ones by getgroups(), one
of
which may be the same as the first number.
However, a value assigned to $( must be a single number used to set
the real gid. So the value given by $( should *not* be assigned
back
to $( without being forced numeric, such as by adding zero.
You can change both the real gid and the effective gid at the same
time by using POSIX::setgid(). Changes to $( require a check to $!
to detect any possible errors after an attempted change.
(Mnemonic: parentheses are used to *group* things. The real gid is
the group you *left*, if you're running setgid.)
$EFFECTIVE_GROUP_ID
$EGID
$) The effective gid of this process. If you are on a machine that
supports membership in multiple groups simultaneously, gives a
space
separated list of groups you are in. The first number is the one
returned by getegid(), and the subsequent ones by getgroups(), one
of which may be the same as the first number.
Similarly, a value assigned to $) must also be a space-separated
list of numbers. The first number sets the effective gid, and the
rest (if any) are passed to setgroups(). To get the effect of an
empty list for setgroups(), just repeat the new effective gid; that
is, to force an effective gid of 5 and an effectively empty
setgroups() list, say " $) = "5 5" ".
You can change both the effective gid and the real gid at the same
time by using POSIX::setgid() (use only a single numeric argument).
Changes to $) require a check to $! to detect any possible errors
after an attempted change.
(Mnemonic: parentheses are used to *group* things. The effective
gid
is the group that's *right* for you, if you're running setgid.)
$<, $>, $( and $) can be set only on machines that support the
corresponding *set[re][ug]id()* routine. $( and $) can be swapped
only on machines supporting setregid().
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs