Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
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:
--Mike
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:
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?#!/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;
--Mike
|
---|
Replies are listed 'Best First'. | |
---|---|
(RhetTbull) Re: Net::SSH::Perl and protocol 2?
by RhetTbull (Curate) on May 08, 2002 at 16:49 UTC | |
by Anonymous Monk on May 08, 2002 at 19:46 UTC | |
Re: Net::SSH::Perl and protocol 2?
by runrig (Abbot) on May 08, 2002 at 20:27 UTC | |
Re: Net::SSH::Perl and protocol 2?
by Anonymous Monk on Jun 13, 2002 at 13:39 UTC |
Back to
Seekers of Perl Wisdom