Net::SSH::Perl - Channel open failure?



I am attempting to write a couple of test scripts to use SSH for
connecting to a host, executing commands, and displaying the results..

I've exhausted my google-fu (even Google code search) and hoped
someone might be able to enlighten me as to why this script is
failing.

I'm receiving "Channel open failure: 1: reason 1: open failed" in my
debug statements. From what I can tell, all this means is the SSH
Open was administratively prohibited (for any number of reasons).

What I'm confused about, though, is I connect to my test host using
SSH 2. And in the Net::SSH::Perl docs, it says "SSH-2 fuly supports
running more than one command over the same connection". However, in
my debug info (below) it looks like my script is attempting to open a
second connection (channel 1) for sending the command instead of using
the currently open connection (channel 0).

Is there something special I need to do to utilize the existing open
connection for subsequent commands? Or, am I way out in left-field on
ths problem?

Any suggestions or advice would be greatly appreciated.

- - BEGIN - SCRIPT - - - - - - - -

use Net::SSH::Perl;
use strict;
use warnings;
my $host = "example.host.com";
my $user = "username";
my $password = "password";
my $cmd = "ls";
my $ssh = Net::SSH::Perl->new(
$host,
debug => 1,
protocol => '2,1',
port => 22
);
$ssh->login( $user, $password );
$ssh->register_handler(
"stdout",
sub {
my ( $channel, $buffer ) = @_;
print "I received this: ", $buffer->bytes;
}
);
$ssh->cmd($cmd);

- - END - SCRIPT - - - - - - - -

- - BEGIN - OUTPUT - - - - - - - -

development[/home/user]# test-ssh.pl
development: Reading configuration data //.ssh/config
development: Reading configuration data /etc/ssh_config
development: Allocated local port 1021.
development: Connecting to example.host.com, port 22.
development: Remote version string: SSH-2.0-OpenSSH_2.9p2

development: Remote protocol version 2.0, remote software version
OpenSSH_2.9p2
development: Net::SSH::Perl Version 1.30, protocol version 2.0.
development: No compat match: OpenSSH_2.9p2.
development: Connection established.
development: Sent key-exchange init (KEXINIT), wait response.
development: Algorithms, c->s: 3des-cbc hmac-sha1 none
development: Algorithms, s->c: 3des-cbc hmac-sha1 none
development: Entering Diffie-Hellman Group 1 key exchange.
development: Sent DH public key, waiting for reply.
development: Received host key, type 'ssh-dss'.
development: Host 'example.host.com' is known and matches the host
key.
development: Computing shared secret key.
development: Verifying server signature.
development: Waiting for NEWKEYS message.
development: Enabling incoming encryption/MAC/compression.
development: Send NEWKEYS, enable outgoing encryption/MAC/compression.
development: Sending request for user-authentication service.
development: Service accepted: ssh-userauth.
development: Trying empty user-authentication request.
development: Authentication methods that can continue: keyboard-
interactive,password.
development: Next method to try is password.
development: Trying password authentication.
development: Login completed, opening dummy shell channel.
development: channel 0: new [client-session]
development: Requesting channel_open for channel 0.
development: channel 0: open confirm rwindow 0 rmax 16384
development: Got channel open confirmation, requesting shell.
development: Requesting service shell on channel 0.
development: channel 1: new [client-session]
development: Requesting channel_open for channel 1.
development: Entering interactive session.
development: Channel open failure: 1: reason 1: open failed
development[/home/user]#

- - END - OUTPUT - - - - - - - - - -

.



Relevant Pages

  • understanding chkrootkit: sshd section
    ... Rhosts Authentication disabled, originating port will not be trusted. ... Secure connection to %.100s on port %hu refused%.100s. ... Warning: Remote host refused compression. ... Received RSA challenge from server. ...
    (comp.os.linux.security)
  • understanding chkrootkit: sshd section
    ... Rhosts Authentication disabled, originating port will not be trusted. ... Secure connection to %.100s on port %hu refused%.100s. ... Warning: Remote host refused compression. ... Received RSA challenge from server. ...
    (comp.security.unix)
  • Re: ICS and FS trouble
    ... >>>client for ms networks, service advertising protocol, file and printer ... >>>execept that the MS beta AntiSpyware connects to the internet and recognises ... >> Microsoft doesn't support changing the ICS host computer's LAN ... >> Internet connection has a 192.168.0.x address that can't be changed to ...
    (microsoft.public.windowsxp.network_web)
  • Re: understanding chkrootkit: sshd section
    ... Connection will not be encrypted. ... > Rhosts Authentication disabled, originating port will not be trusted. ... > Could not request local forwarding. ... Remote host failed or refused to allocate a pseudo tty. ...
    (comp.os.linux.security)
  • Re: understanding chkrootkit: sshd section
    ... Connection will not be encrypted. ... > Rhosts Authentication disabled, originating port will not be trusted. ... > Could not request local forwarding. ... Remote host failed or refused to allocate a pseudo tty. ...
    (comp.security.unix)