Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Net::SSH::Perl not working on Windows server

by shonorio (Hermit)
on Dec 08, 2005 at 18:50 UTC ( #515334=perlquestion: print w/replies, xml ) Need Help??

shonorio has asked for the wisdom of the Perl Monks concerning the following question:

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

Replies are listed 'Best First'.
Re: Net::SSH::Perl not working on Windows server
by jfroebe (Parson) on Dec 08, 2005 at 19:01 UTC

    Hi Sao,

    On your linux box, open up /etc/ssh/sshd.conf Most likely the allow root login is disabled preventing you from logging into the linux box as root.

    Try using putty to determine if it is a ssh configuration issue or can be restricted to a Net::SSH issue.

    Hope this helps.

    Jason L. Froebe

    Team Sybase member

    No one has seen what you have seen, and until that happens, we're all going to think that you're nuts. - Jack O'Neil, Stargate SG-1

      On my linux root is allowed to ssh (test enviroment of course). I can access by putty or ssh without problem, and I getting the same behaviour when i run this script on linux box.

      Maybe it's a bug on Net::SSH::Perl

      Jason, thanks for you help.

      Solli Moreira Honorio
      Sao Paulo - Brazil
        I wonder if this is the problem you are experiencing

        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
        


        Net:SSH:Perl does it all for you. I'm thinking you are trying to authenticate with a method your remote system requires and Net::SSH::Perl doesn't have loaded. Your OS will be ok if it has the method required. You might want to check the modules loaded and see if they compare with what the OS needs.

        Try perldoc perllocal and see if all the modules are there. Don't forget to check the README in Net::SSH::Perl. It has a list of what modules you need for which protocol. Just a few things to check on.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://515334]
Approved by ww
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (8)
As of 2020-11-24 21:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?