On 7/6/07, Lakshmi Sailaja <[EMAIL PROTECTED]> wrote:
my $pid = open3($wr, $rd, $er, 'sudo -S su - username');
No, you're still using su for what sudo is doing. You want to use sudo's -u option to specify the username, maybe like this: my $pid = open3($wr, $rd, $er, "sudo -S -u $username " . 'someCommand -its -options' # command for sudo to run ); Of course, someCommand needs to be whatever you're really trying to do. In the end, the fourth argument to open3 is a single command line, much as if it were typed into the shell. It goes to sudo, which should read the password from its STDIN and (if all is well) launch someCommand as user $username. If you need to quote any arguments to someCommand, things get lots trickier; but that's sudo. Another word of caution: Since you're not really logged in as the other user, other things (like your current directory, environment variables, favorite shell shortcuts) won't be set up as that user might expect. Good luck with it! --Tom Phoenix Stonehenge Perl Training -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/