Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Net::SSH::W32Perl rev 0.05, cmd hangs. Does Net::SSH::W32Perl 0.06 exist?

by KalTorak (Initiate)
on Jul 26, 2008 at 00:16 UTC ( #700257=perlquestion: print w/ replies, xml ) Need Help??
KalTorak has asked for the wisdom of the Perl Monks concerning the following question:

Does the reputed Net::SSH::W32Perl rev 0.06 actually exist? People claim they have it, but soulcage.net is gone, and installing PPMs directly from there seemed to be involved... I've got ActiveState perl 5.8.8 build 822 installed. I got Net::SSH::W32Perl (rev 0.05) installed from the UWinnipeg PPM repository, and I'm trying to do a simple "Run a command on a Unix box" script. Most(?) importantly, I uninstalled Net::SFTP, Net::SSH::Perl, and Net::SSH::W32Perl, and installed only Net::SSH::W32Perl (and let it take care of its own dependencies) - that seems to have been some people's answer. I hit the getpwuid problem, I set HOME=something, and got around it. I couldn't authenticate against the ssh daemon on the other end, I got a public/private key pair set up and working - I can login. But as soon as I try a cmd(), I hang. Lots of people seem to have a similar issue, and I can't seem to find a fix. My script (with a couple things anonymized):
use Net::SSH::W32Perl; $host = "myserver"; $user = "myuserid"; my $ssh = Net::SSH::W32Perl->new($host, debug => 1, interactive => 0, use_pty => 0, identity_files => ["id_rsa"]); $ssh->login($user); $cmd = '/usr/bin/date > ~/date'; #my($out, $err, $exit) = $ssh->cmd($cmd); $ssh->cmd($cmd, "\n"); print "STDOUT: $out"; print "\n\n"; print "STDERR: $err"; print "\n\n"; print "ExitCode: $exit"; print "\n\n";
The results:
... client: Requesting service shell on channel 0. client: channel 1: new [client-session] client: Requesting channel_open for channel 1. client: Entering interactive session. client: Sending command: /usr/bin/date > ~/date client: Requesting service exec on channel 1. client: channel 1: send eof client: channel 1: open confirm rwindow 262143 rmax 16384 (and here we hang indefinitely)
I've redirected stdout in the command I'm sending, and I've left it non-redirected - no difference. I tried adding and removing the "\n" argument to the cmd() arg list - removing it drops the "client: channel 1: send eof" debug info, but that's all. I made sure to install only the W32Perl module, so it could manage its own dependencies - no difference. I know the command works - there's a ~/date file that's getting created on the server side... it's just that my client script hangs. Am I missing something? Is there any solution which does NOT involve installing the PPMs from a Soulcage repository that doesn't exist? Thanks!

Comment on Net::SSH::W32Perl rev 0.05, cmd hangs. Does Net::SSH::W32Perl 0.06 exist?
Select or Download Code
Re: Net::SSH::W32Perl rev 0.05, cmd hangs. Does Net::SSH::W32Perl 0.06 exist?
by syphilis (Canon) on Jul 26, 2008 at 01:41 UTC
    There is also a Uwinnipeg 5.8 ppm for Net::SSH2. It has no additional dependencies apart from Term::ReadKey. However, some of its constructs don't work on Win32 (though there's usually a way of working around those failing constructs). YMMV - but it could be worth a try.

    Cheers,
    Rob
      I did notice the Net::SSH2 option in the UWinnipeg PPMs; I suppose I could go that way, or could go with plink-style command line tool and send it a bunch of system calls.
      Another strange detail is that other people seem to have success with ssh->cmd() if they redirect its stdout to a file. If I could get that far, I could probably wing the rest of it (through a gross overreliance on downloading the redirected stdout file). I can't even do THAT - even a cmd() with redirected stdout still hangs.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://700257]
Approved by mr_mischief
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (13)
As of 2014-07-28 10:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (195 votes), past polls