Hey Monks,
Just installed F-Secures SSH service on a Windows 2000 server.
I am trying to run a simple "dir" and retrieve the output.

Here's what I have so far.
The Code:
#!d:/perl -w use strict; use Net::SSH::W32Perl; my ($ipaddr,$userid,$passwd) = ("<ipaddress>","<userid>","<password>") +; my $cmd = "dir"; my $ssh = Net::SSH::W32Perl->new("$ipaddr", protocol => '2,1',debug => + 1); my ($out, $err, $exit,$msg); $ssh->login("$userid","$passwd"); ($out, $err, $exit) = $ssh->cmd("$cmd"); print $out. $err. $exit."\n"; close $ssh;
The output with debugging on:
computername: Reading configuration data /.ssh/config computername: Reading configuration data /etc/ssh_config computername: Connecting to computername, port 22. computername: Socket created, turning on blocking... computername: Remote protocol version 2.0, remote software version 3.2 +.0 F-Secure SSH Windows NT Server computername: Net::SSH::Perl Version 1.23, protocol version 2.0. computername: No compat match: 3.2.0 F-Secure SSH Windows NT Server computername: Connection established. computername: Sent key-exchange init (KEXINIT), wait response. computername: Algorithms, c->s: 3des-cbc hmac-sha1 none computername: Algorithms, s->c: 3des-cbc hmac-sha1 none computername: Entering Diffie-Hellman Group 1 key exchange. computername: Sent DH public key, waiting for reply. computername: Received host key, type 'ssh-dss'. computername: Host 'computername' is known and matches the host key. computername: Computing shared secret key. computername: Verifying server signature. computername: Waiting for NEWKEYS message. computername: Enabling incoming encryption/MAC/compression. computername: Send NEWKEYS, enable outgoing encryption/MAC/compression +. computername: Sending request for user-authentication service. computername: Service accepted: ssh-userauth. computername: Trying empty user-authentication request. computername: Authentication methods that can continue: publickey,pass +word. computername: Next method to try is publickey. computername: Next method to try is password. computername: Trying password authentication. computername: Login completed, opening dummy shell channel. computername: channel 0: new [client-session] computername: Requesting channel_open for channel 0. computername: channel 0: open confirm rwindow 100000 rmax 16384 computername: Got channel open confirmation, requesting shell. computername: Requesting service shell on channel 0. computername: channel 1: new [client-session] computername: Requesting channel_open for channel 1. computername: Entering interactive session. computername: Sending command: echo dir computername: Requesting service exec on channel 1. computername: channel 1: open confirm rwindow 100000 rmax 16384
After the channel 1 is open the script hangs. I have run
this against the Windows install and Linux server with
OPENSSH 3.0 install. Same problem. Sorry, this looks
like an easy one. Read all the docs and online info. No Luck so far...Go easy on the initiate :)

A nudge in the right direction is appreciated

MurDog - Chien Mur to my French brothers.

In reply to NET::SSH::W32PERL - script Hangs when trying to run a command by MurDog

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.