Hi Monks -
From my Linux box I'm trying to use Net::SSH::Perl to run a command on a remote Windows box running OpenSSH-3.1 and the CygWin environment. From Linux if I do 'ssh -2 -l configadm <windows ip> "/bin/ls /"', everything works perfectly, so I would think the following code should also work:
#!/usr/bin/perl -w
use Net::SSH::Perl;
use strict;
my $ip = "<windows ip>";
my $pw = "<password>";
my $user = 'configadm';
my $ssh = Net::SSH::Perl->new($ip, protocol=>2);
my ($stdout, $stderr, $exit);
eval {
$ssh->login($user,$pw);
($stdout, $stderr, $exit) = $ssh->cmd('/bin/ls /');
};
if ($@) {
die "@@@@@ failed login or command problem";
}
print $stdout;
exit 0;
The problem is that nothing ever comes back over the ssh session, so $stdout does not get populated. If I execute the same code against a unix box running openssh then everything works perfectly. So, I'm left with either a bug in Net::SSH::Perl, a bug in CygWin, or a bug in OpenSSH for windows or some combination. It works from the command line though, so where does that leave us?
--Mike