Thank you both!
I think this is what I'm going to do:
use Env; ## uid = 0 at this point. ## delete root's env foreach my $key ( keys %ENV ) { delete $ENV{ $key }; } ## set standard PATH, apparently some scripts ## rely on this $ENV{ PATH } = '/bin:/usr/bin:/usr/local/bin:/usr/ucb'; $> = $target_uid; $< = $target_uid; my( $shell, $home ) = ( getpwuid( $> ) ) [ 7, 8 ]; $ENV{ HOME } = $home; my $env_str = qx/exec $shell -c env/; # now parse
In reply to Re: Can you import ENV variables at run time?
by lestrrat
in thread Can you import ENV variables at run time?
by lestrrat
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |