Has anyone gotten any SSH2 perl module to work natively under ActiveState's perl 5.8.8.820 - ie not using cygwin. I've tried net::ssh::perl and net::ssh::w32perl and while I can successfully authenticate hosts when issuing a cmd() the client side loops endlessly in "client_loop". I have made the windows blocking(0) fix to net::ssh::perl::perl.pm's connect() but still no change to the endless loop on the client side. net::expect is a non-starter since it requires cygwin and net::ssh2 requires the world (openssl, etc) pre installed.
Yes, I can use openssh and scrape the output but I was really hoping for a more programmatic solution. Perl 5.10 isn't an option since most modules have not been converted yet.
Any suggestions?
The following is working for me using ActiveState's Perl 5.8.8.817:
sub Carp::carp {}; # Turn off annoying debug msgs
my $ssh = new Net::SSH::W32Perl("xxx.xxxxxx.xxx");
$ssh->login('xxxxx', 'xxxxx');
($out, $err, $exit) = $ssh->cmd('cd /home/backups; ./dobackup.pl; ls');
print "\n", $out, "\n";
$null = <STDIN>; # Pause console
Yea, that's the same format I have been trying to use. With 820 I can authenticate via either the password or RSA key but cmd just goes into an endless loop in client_loop() looking for something to pull from one of the channels. From the 'net I've seen that older versions of AP seem to work - but newer ones are not. From my tracing I'm wondering if the socket module is the culprit.
I did add to Net::SSH::Perl.pm::connect() the windows FIONBIO fix for non-blocking sockets and from my reading it seems WSA_FLAG_OVERLAPPED might also be necessary on the socket creation.
If I manually issue the ssh cli command between the windows nodes with a command option it all works so it definitely is in the perl side. My workaround is to write a target side wrapper to issue the ssh cli against and then scape the results and return code from...but obviously that's not a good solution. :(
Anyone get Net::SSH::Perl / W32Perl to work with 820?
Does anyone have net::ssh2 or net::ssh working with perl V5.10.0?
Thanks for any info.
Hi
I don't know if this helps at all, but I'm a big user of dbrobins@cpan.org Net::SSH::Perl module on windows and linux. I can get versions up to 1.26 to run on windows with a slight modification of _connect().
> ...snip...
> my $temp = 1;
> ioctl ($sock, 0x8004667E, \$temp) || die( "ioctl non-blocking failed" );
> #fcntl($sock, F_SETFL, O_NONBLOCK)
> # or die "Can't set socket non-blocking: $!";
>
> $ssh->debug("Connection established.");
}
Net::SSH::W32Perl 0.05 just does not seem to work - for me at least, and the soulcage repository seems to have disappeared. Later versions of Net::SSH::Perl I can't get to run on windows.
I wrote to ActivePerl November 2007 asking if they would do a branch and provide a ppm for ssh on Windows. It's crucial, basic requirement now. Come on ActivePerl - get one of your superb boffins on the job - we need a properly supported package! ;-)
I have problem while connect to unix box using ssh from windows my code looks like this
use Net::SSH::W32Perl;
sub Carp::carp {}; # Turn off annoying debug msgs
my $ssh = new Net::SSH::W32Perl("xxx.xxxxxx.xxx");
$ssh->login('xxxxx', 'xxxxx');
but when I run the script I am getting the following error can any one help me on this I am trying for the soultion for a long time.
The error is
Subroutine Carp::carp redefined at login4.pl line 5.
Undefined subroutine &Math::Pari::log called at C:/Perl/lib/Net/SSH/Perl/Util/SSH2MP.pm line 9.
Hello,
Anyone has some pointers where I can download and do a clean install for that SSH package? Net::SSH::Perl maybe?
The target system is Windows 7-64bit.
Thanks!
Ides