Hi Mongers,

I'm writting scripts that will get information on firewall Linux Debian from a Windows server, and to get my job done, I think to use Net::SSH::Perl (version 1.29).

But i'm getting two different problem with this module, one is when I trying to logon on debian OpenSSH 3.8.1p1. In this situation i get the 'Permission denied', like code and debug message bellow,

use Net::SSH::Perl; my $fw = Net::SSH::Perl->new( 'server1', debug => 1 ); $fw->login( 'root','1234567890'); my ($stdout, $stderr, $exit) = $fw->cmd('ls -lh /etc'); print $stdout; ############## OUTPRINT DEBUG ######## client_win2k: Reading configuration data /.ssh/config client_win2k: Reading configuration data /etc/ssh_config client_win2k: Connecting to server1, port 22. client_win2k: Socket created, turning on blocking... client_win2k: Remote protocol version 2.0, remote software version Ope +nSSH_3.8.1p1 Debian-8.sarge.4 client_win2k: Net::SSH::Perl Version 1.29, protocol version 2.0. client_win2k: No compat match: OpenSSH_3.8.1p1 Debian-8.sarge.4. client_win2k: Connection established. client_win2k: Sent key-exchange init (KEXINIT), wait response. client_win2k: Algorithms, c->s: 3des-cbc hmac-sha1 none client_win2k: Algorithms, s->c: 3des-cbc hmac-sha1 none client_win2k: Entering Diffie-Hellman Group 1 key exchange. client_win2k: Sent DH public key, waiting for reply. client_win2k: Received host key, type 'ssh-dss'. client_win2k: Host 'server1' is known and matches the host key. client_win2k: Computing shared secret key. client_win2k: Verifying server signature. client_win2k: Waiting for NEWKEYS message. client_win2k: Enabling incoming encryption/MAC/compression. client_win2k: Send NEWKEYS, enable outgoing encryption/MAC/compression +. client_win2k: Sending request for user-authentication service. client_win2k: Service accepted: ssh-userauth. client_win2k: Trying empty user-authentication request. client_win2k: Authentication methods that can continue: publickey,keyb +oard-interactive. client_win2k: Next method to try is publickey. Permission denied at C:\Test\t.pl line 3
or... when I trying to execute a single command (Debian OpenSSH 3.0). My code stop response.
use Net::SSH::Perl; my $fw = Net::SSH::Perl->new( 'server2', debug => 1 ); $fw->login( 'root','1234567890'); my ($stdout, $stderr, $exit) = $fw->cmd('ls -lh /etc'); print $stdout; ############## OUTPRINT DEBUG ######## client_win2k: Reading configuration data /.ssh/config client_win2k: Reading configuration data /etc/ssh_config client_win2k: Connecting to server2, port 22. client_win2k: Remote protocol version 2.0, remote software version Ope +nSSH_3.0.2p1 Debian 1:3.0.2p1-9 client_win2k: Net::SSH::Perl Version 1.29, protocol version 2.0. client_win2k: No compat match: OpenSSH_3.0.2p1 Debian 1:3.0.2p1-9. client_win2k: Connection established. client_win2k: Sent key-exchange init (KEXINIT), wait response. client_win2k: Algorithms, c->s: 3des-cbc hmac-sha1 none client_win2k: Algorithms, s->c: 3des-cbc hmac-sha1 none client_win2k: Entering Diffie-Hellman Group 1 key exchange. client_win2k: Sent DH public key, waiting for reply. client_win2k: Received host key, type 'ssh-dss'. client_win2k: Permanently added 'server2' to the list of known hosts. client_win2k: Computing shared secret key. client_win2k: Verifying server signature. client_win2k: Waiting for NEWKEYS message. client_win2k: Enabling incoming encryption/MAC/compression. client_win2k: Send NEWKEYS, enable outgoing encryption/MAC/compression +. client_win2k: Sending request for user-authentication service. client_win2k: Service accepted: ssh-userauth. client_win2k: Trying empty user-authentication request. client_win2k: Authentication methods that can continue: publickey,pass +word,keyboard-interactive. client_win2k: Next method to try is publickey. client_win2k: Next method to try is password. client_win2k: Trying password authentication. client_win2k: Login completed, opening dummy shell channel. client_win2k: channel 0: new [client-session] client_win2k: Requesting channel_open for channel 0. client_win2k: channel 0: open confirm rwindow 0 rmax 16384 client_win2k: Got channel open confirmation, requesting shell. client_win2k: Requesting service shell on channel 0. client_win2k: channel 1: new [client-session] client_win2k: Requesting channel_open for channel 1. client_win2k: Entering interactive session. client_win2k: Sending command: ls -lh /etc client_win2k: Requesting service exec on channel 1. client_win2k: channel 1: open confirm rwindow 0 rmax 16384
Thanks for any help...

Solli Moreira Honorio
Sao Paulo - Brazil

In reply to Net::SSH::Perl not working on Windows server by shonorio

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.