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

Please any one help me..
I have perl enviroment in windows.I want ssh and Scp to
AIX,Solaris from my windows machine.i using Net::SSH::W32Perl

use Net::SSH::W32Perl; my $ssh = Net::SSH::W32Perl->new($host,debug=>1); $ssh->login('$user','$pass'); my($stdout, $stderr, $exit) = $ssh->cmd("/bin/bash /bin/ls -lrt"); print "$stdout, $stderr, $exit";

system is hanging no output and error....
while iam using option debug=>1 ,it is printing and also system is hanging .
iam giving last few lines, while i use the debug=>1 option

indamaaaf31786: Got channel open confirmation, requesting shell.
indamaaaf31786: Requesting service shell on channel 0.
indamaaaf31786: channel 1: new client-session
indamaaaf31786: Requesting channel_open for chann
l 1. indamaaaf31786: Entering interactive session.
indamaaaf31786: Sending command: /bin/bash /bin/ls -lrt
indamaaaf31786: Requesting service exec on channel 1.
indamaaaf31786: channel 1: open confirm rwindow 0 rmax 32768
indamaaaf31786: input_channel_request: rtype exit-status reply 0

After these lines it is hanging what is problem ?.please guide me...

Replies are listed 'Best First'.
Re: ssh on windows
by Joost (Canon) on Jul 05, 2006 at 05:56 UTC
    Don't do
    $ssh->login('$user','$pass');
    That will send the literal strings $user and $pass, NOT the value of the variables.

    Also, you probably shouldn't put a name and password in your script at all. SSH has much better ways of dealing with authentication.

    In any case I expect that that isn't the real code you're actually running, which might or might not make a difference. Can you log in from that machine using another SSH client?

    Update: Try removing the "/bin/bash" part, i.e, do:

    my($stdout, $stderr, $exit) = $ssh->cmd("/bin/ls -lrt");
    A reply falls below the community's threshold of quality. You may see it by logging in.
Re: ssh on windows
by shmem (Chancellor) on Jul 05, 2006 at 07:31 UTC
    Please read in your other thread on the same about things that can go wrong, and give us details about the remote machine (OS? version? ssh version?) and your environment there (login shell?). Are you able to login with e.g putty?

    Also, try sending a single command without arguments, e.g. ls or pwd.

    --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}
      os is AIX 5.2 and Net::SSH::Perl Version 1.29, protocol version 2.0.
      yes iam login with Putty and do the things also ..
        What is your login shell? (type echo $SHELL at the command line prompt)