perlquestion
dorko
Hello,
<P>I'm trying to SSH from a Windows XP desktop to a Solaris box and run a command. I've installed [mod://Net::SSH::W32Perl] on the Windows box. The script below seems to login correctly and send the command, but then it just hangs.<P>
(For others researching this topic, the Web suggests commenting out lines 213 and 214 of <a href="http://cpansearch.perl.org/src/TURNSTEP/Net-SSH-Perl-1.34/lib/Net/SSH/Perl.pm">Net:SSH::Perl.pm</a> to get it working on Windows. If you install and use Net::SSH::W32Perl, it redefines the troublesome function in Net::SSH::Perl and you don't have to edit Net::SSH::Perl.)
<P>I found this [id://313666] and followed it's advise, but soulcage.net seems to be defunct.
<P>Does anyone have any suggestions?
<P>The script:
<c>
use strict;
use warnings;
use Net::SSH::W32Perl;
$ENV{HOME} = 'C:\shaw\ssh';
my $host = 'super.cool.server';
my $ssh = Net::SSH::W32Perl->new($host, protocol => '2',
debug => 1 );
my $user = 'supercooluser';
my $pass = 'supercoolpass';
$ssh->login($user, $pass);
my $cmd = "pwd";
my($stdout, $stderr, $exit) = $ssh->cmd($cmd);
print $stdout;
print $stderr;
print $exit;
</c>
<P>
The only results are the debug messages:
<c>
brentshaw: Reading configuration data C:\shaw\ssh/.ssh/config
brentshaw: Reading configuration data /etc/ssh_config
brentshaw: Connecting to xxx.xxx.xxx.xxx, port 22.
brentshaw: Socket created, turning on blocking...
brentshaw: Remote protocol version 2.0, remote software version Sun_SSH_1.1.3
brentshaw: Net::SSH::Perl Version 1.34, protocol version 2.0.
brentshaw: No compat match: Sun_SSH_1.1.3.
brentshaw: Connection established.
brentshaw: Sent key-exchange init (KEXINIT), wait response.
brentshaw: Algorithms, c->s: 3des-cbc hmac-sha1 none
brentshaw: Algorithms, s->c: 3des-cbc hmac-sha1 none
brentshaw: Entering Diffie-Hellman Group 1 key exchange.
brentshaw: Sent DH public key, waiting for reply.
brentshaw: Received host key, type 'ssh-dss'.
brentshaw: Host 'xxx.xxx.xxx.xxx' is known and matches the host key.
brentshaw: Computing shared secret key.
brentshaw: Verifying server signature.
brentshaw: Waiting for NEWKEYS message.
brentshaw: Send NEWKEYS.
brentshaw: Enabling encryption/MAC/compression.
brentshaw: Sending request for user-authentication service.
brentshaw: Service accepted: ssh-userauth.
brentshaw: Trying empty user-authentication request.
brentshaw: Authentication methods that can continue: gssapi-keyex,gssapi-with-mic,publickey,password,keyboard-interactive.
brentshaw: Next method to try is publickey.
brentshaw: Next method to try is password.
brentshaw: Trying password authentication.
brentshaw: Login completed, opening dummy shell channel.
brentshaw: channel 0: new [client-session]
brentshaw: Requesting channel_open for channel 0.
brentshaw: channel 0: open confirm rwindow 0 rmax 32768
brentshaw: Got channel open confirmation, requesting shell.
brentshaw: Requesting service shell on channel 0.
brentshaw: channel 1: new [client-session]
brentshaw: Requesting channel_open for channel 1.
brentshaw: Entering interactive session.
brentshaw: Sending command: pwd
brentshaw: Sending command: pwd
brentshaw: Requesting service exec on channel 1.
brentshaw: channel 1: open confirm rwindow 0 rmax 32768
</c>
<P>I'm not sure why <c>brentshaw: Sending command: pwd</c> appears twice in the debug messages, but it does.
<P>
Cheers,<P>
Brent<BR>
<div class="pmsig"><div class="pmsig-10261">
<I>-- Yeah, I'm a <A HREF="http://www.delts.org/">Delt</A>.</I>
</div></div>