bless$self=>perlmonks; has asked for the wisdom of the Perl Monks concerning the following question:
I'm having problems understanding how the $UID, $GID, $EUID, and $EGID variables work. Here are some examples: If I assign the variables like this:
Then it appears as if my script is still in one of root's groups. My debugging output shows:$UID = $new_uid; $GID = $new_gid; $EUID = $new_uid; $EGID = "$new_gid $new_gid";
1001 and 100 are the user's uid and gid, so those are correct, but 33 is a group that root is in, but the user is not in. The script shouldn't be in that group anymore.UID: '1001' GID: '100 33' EUID: '1001' EGID: '100 33'
However, if I assign the variables in a different order, the results are not the same. Assigning like this:
results in what appears to be what I want:($UID, $GID) = ($new_uid, $new_gid); ($EUID, $EGID) = ($new_uid, "$new_gid $new_gid");
I know that list variables inside a list assignment are assigned in parallel.... but why does the order affect the result? And should I be changing $UID and $GID, or just $EUID and $EGID?UID: '1001' GID: '100 100' EUID: '1001' EGID: '100 100'
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: changing uid/gid in suid cgi script
by Zaxo (Archbishop) on Sep 06, 2001 at 07:35 UTC | |
by jj808 (Hermit) on Sep 06, 2001 at 11:51 UTC | |
|
Re: changing uid/gid in suid cgi script
by Anonymous Monk on Sep 06, 2001 at 07:12 UTC | |
|
Re: changing uid/gid in suid cgi script
by ncw (Friar) on Sep 06, 2001 at 12:11 UTC |