Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi, I am trying to do a rsh to another linux box using kerberos authentication and run a local perl script on the remote host. The following piece of code works fine on solaris but not on linux.
#my $cmd = "$rsh_cmd -l $user $host \"$perl_loc - $main::sc_destdir @m +ain::sc_destsubdirs\"\n"; my ($in, $out, $err) = (gensym(), gensym(), gensym()); my $pid = open3($in, $out, $err, $cmd); my $sis_fname = $main::fp_syscheck_install_status_pl; # above is another local perl script which is to be run on remote mach +ine my $fh = new FileHandle "<$sis_fname"; die "Unable to open $sis_fname" unless ($fh); my @sis = <$fh>; print $in @sis; close ($in);
I have tried doing rsh on the prompt and it works fine. But when I run this code, $err returns "Connection closed". Any help is much appreciated.

Replies are listed 'Best First'.
Re: IPC::open3 on linux with kerberos authentication
by shmem (Chancellor) on May 24, 2007 at 12:43 UTC
    I'd check the return value of open3. Then I'd look whether the print $in @sis succeeds.

    It's hard to say what the cause of the failure might be, since you don't reveal the actual command being invoked. I guess it is something involving rsh(1). You might want to check the manual pages on Solaris and Linux for implementation differences, i.e. command line switches.

    Then, I'd run that script under strace -f -ff -o script-out to check the resulting output for the forked rsh.

    --shmem

    _($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                                  /\_¯/(q    /
    ----------------------------  \__(m.====·.(_("always off the crowd"))."·
    ");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}