bluto has asked for the wisdom of the Perl Monks concerning the following question:
# perl -e '$< = 81' setruid() not implemented at -e line 1.
I can understand this, since this function doesn't exist on AIX. Is there a workaround here to get perl to execute the C function setuid() instead? I'd really like to do something like this...
$pid = fork; die unless defined $pid; unless ($pid) { $< = $> = $bobs_uid; exec "foo"; }
... so that the child runs unpriviledged.
I can't just set $> ($EUID) since the child can just set it back to zero. I can't use POSIX::setuid() since that give the same error. I suppose I could do something outside of perl like use a C wrapper that calls setuid() or something grotesque like...
... but I'd really like to do this in perl.system("su bob -c foo &"); #syntax?
Thanks
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Why can't I set $< ?
by pg (Canon) on Mar 08, 2003 at 04:10 UTC |