CPAN::Forum
Net-SSH-Perl - Re: Channel open failure: 1: reason 4: when connecting to Cisco router
| Posted on Tue Jun 20 11:27:27 2006 by cjenn75 in response to 1630 (See the whole thread of 18) |
| Re: Channel open failure: 1: reason 4: when connecting to Cisco router |
|
I am really battling to get this to work as you described. I am unable to run any commands at all, it appears to be referencing other parts of the script which i cant identify. Can you please post the exact lines i should comment out?
Here is my 'sub login':
sub login {
my $ssh = shift;
$ssh->SUPER::login(@_);
my $suppress_shell = $_[2];
$ssh->_login or $ssh->fatal_disconnect("Permission denied");
# $ssh->debug("Login completed, opening dummy shell channel.");
# my $cmgr = $ssh->channel_mgr;
# my $channel = $cmgr->new_channel(
# ctype => 'session', local_window => 0,
# local_maxpacket => 0, remote_name => 'client-session');
# $channel->open;
# my $packet = Net::SSH::Perl::Packet->read_expect($ssh,
# SSH2_MSG_CHANNEL_OPEN_CONFIRMATION);
# $cmgr->input_open_confirmation($packet);
# unless ($suppress_shell) {
# $ssh->debug("Got channel open confirmation, requesting shell.");
# $channel->request("shell", 0);
# }
}
This seemingly allows me to login (it successfully authenticates to tacacs) but this is as far as i get to being able to run a command:
<snip....>
Authentication methods that can continue: password.
Next method to try is password.
Trying password authentication.
channel 0: new [client-session]
Requesting channel_open for channel 0.
Entering interactive session.
Sending command: ls
Requesting service exec on channel 0.
channel 0: open confirm rwindow 1024 rmax 4096
and that's all. When i uncomment the hashed lines in sub login and attempt to auth to a unix host i get this:
<snip....>
Authentication methods that can continue: publickey,gssapi-with-mic,password.
Next method to try is publickey.
Next method to try is password.
Trying password authentication.
Login completed, opening dummy shell channel.
channel 0: new [client-session]
Requesting channel_open for channel 0.
channel 0: open confirm rwindow 0 rmax 32768
Got channel open confirmation, requesting shell.
Requesting service shell on channel 0.
channel 1: new [client-session]
Requesting channel_open for channel 1.
Entering interactive session.
Sending command: ls
Requesting service exec on channel 1.
channel 1: open confirm rwindow 0 rmax 32768
channel 1: rcvd eof
channel 1: output open -> drain
input_channel_request: rtype exit-status reply 0
channel 1: rcvd close
channel 1: input open -> closed
channel 1: close_read
channel 1: obuf empty
channel 1: output drain -> closed
channel 1: close_write
channel 1: send close
channel 1: full closed
So everything from rcvd eof downwards is being skipped, nothing is being outputted to $stdout so am not able to see output of command.
Any help you can provide would be great. Thanks!
|
| Write a response |
(10)
]