gideondsouza has asked for the wisdom of the Perl Monks concerning the following question:
Currently I have a line in my perl code that does this:
use IPC::Run qw(run); my ($stdout, $stderr); run [ qw/perl -e/, $code ], '<', \$arg, '>>', \$stdout, '2>>', \$stder +r;
I use IPC::Run::run to run some perl code.
I want to run it under a separate user : limiteduser, I'm probably not thinking in *nix terms so I'm just not sure about how to do this? Should I do:
run [ qw/sudo -u limiteduser perl -e/, $code ], '<', \$arg, '>>', \$stdout, '2>>', \$stderr;
OR should I use Sudo to do this?
My Goal is that if there is a system call inside $code then it should fail, as limiteduser doesn't have such privileges
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: run perl -e programmatically as another user
by tobyink (Canon) on Mar 05, 2013 at 14:30 UTC | |
|
Re: run perl -e programmatically as another user
by blue_cowdawg (Monsignor) on Mar 05, 2013 at 14:35 UTC |