[Ssh-sftp-perl-users] Net::SSH::Perl issue
Brought to you by:
dbrobins
|
From: Ivaylo T. <iva...@gm...> - 2010-02-03 18:27:06
|
Hi,
I am using following code to configure Juniper router:
my $ssh = Net::SSH::Perl->new($ip, protocol => 2);
$ssh->login($user, $pass);
foreach (@commands)
{
my($out, $err, $exit) = $ssh->cmd($_);
}
but seems that every command in @commands is transmitted in a separate
channel than the previous despite that the protocol is SSH2.
With first command I am in configuration mode (look at Log file bellow)),
but the next command is executed in non-configuration mode on next channel.
What can I do to send all commands in one single channel ?
*___________________________________________*
*Debug output:*
Reading configuration data /root/.ssh/config
Reading configuration data /etc/ssh_config
Allocated local port 1023.
Connecting to X.Y.Z.W, port 22.
Remote version string: SSH-2.0-OpenSSH_4.4
Remote protocol version 2.0, remote software version OpenSSH_4.4
Net::SSH::Perl Version 1.30, protocol version 2.0.
No compat match: OpenSSH_4.4.
Connection established.
Sent key-exchange init (KEXINIT), wait response.
Algorithms, c->s: 3des-cbc hmac-sha1 none
Algorithms, s->c: 3des-cbc hmac-sha1 none
Entering Diffie-Hellman Group 1 key exchange.
Sent DH public key, waiting for reply.
Received host key, type 'ssh-dss'.
Host 'X.Y.Z.W' is known and matches the host key.
Computing shared secret key.
Verifying server signature.
Waiting for NEWKEYS message.
Enabling incoming encryption/MAC/compression.
Send NEWKEYS, enable outgoing encryption/MAC/compression.
Sending request for user-authentication service.
Service accepted: ssh-userauth.
Trying empty user-authentication request.
Authentication methods that can continue:
publickey,password,keyboard-interactive.
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: edit
Requesting service exec on channel 1.
channel 1: open confirm rwindow 0 rmax 32768
input_channel_request: rtype exit-status reply 0
channel 1: rcvd eof
channel 1: output open -> drain
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
channel 2: new [client-session]
Requesting channel_open for channel 2.
Entering interactive session.
Sending command: set interfaces ge-1/1/0 unit 71 description VRF-XYZ
Requesting service exec on channel 2.
channel 2: open confirm rwindow 0 rmax 32768
input_channel_request: rtype exit-status reply 0
channel 2: rcvd eof
channel 2: output open -> drain
channel 2: rcvd close
channel 2: input open -> closed
channel 2: close_read
channel 2: obuf empty
channel 2: output drain -> closed
channel 2: close_write
channel 2: send close
channel 2: full closed
channel 3: new [client-session]
Requesting channel_open for channel 3.
Entering interactive session.
Sending command: set interfaces ge-1/1/0 unit 71 vlan-id 71
Requesting service exec on channel 3.
channel 3: open confirm rwindow 0 rmax 32768
input_channel_request: rtype exit-status reply 0
channel 3: rcvd eof
channel 3: output open -> drain
channel 3: rcvd close
channel 3: input open -> closed
channel 3: close_read
channel 3: obuf empty
channel 3: output drain -> closed
channel 3: close_write
channel 3: send close
channel 3: full closed
channel 4: new [client-session]
Requesting channel_open for channel 4.
....
_____________________________________________
*Log file:*
edit
Entering configuration mode
set interfaces ge-1/1/0 unit 71 description VRF-XYZ
error: syntax error, expecting <command>: interfaces
set interfaces ge-1/1/0 unit 71 vlan-id 71
error: syntax error, expecting <command>: interfaces
commit and-quit
error: unknown command: commit
_____________________________________________
Thank you in advance.
|