Hi,

After reading the docs, I ended up with these lines:

#!/usr/local/bin/perl
use warnings;
use strict;

use Net::SSH2;

my $ssh2 = Net::SSH2->new();
$ssh2->method('HOSTKEY', 'ssh-rsa');
$ssh2->connect('192.168.1.1') or die;
$ssh2->auth_publickey ('admin', '/root/.ssh/id_rsa.pub', '/root/.ssh/identity');
my $cmd = $ssh2->channel();
$cmd->exec('get sys stat');

I'm not really sure what I'm doing here. I can see now that Net::SSH2 is a bit 
faster than that of Net::SSH::Perl even after installing Math::pari I think... 
On the server, I can see a fast scrolling lines, a sign of much faster 
negotiation.

However, after executing my script, nothing happens... Although I know 
authentication was successful.. At the bottom of the server's debug, I can see 
these:

SH: secure_filename: checking '/data/etc/ssh'
SSH: secure_filename: checking '/data/etc'
SSH: secure_filename: checking '/data'
SSH: secure_filename: checking '/'
SSH: matching key found: file /etc/ssh/admin_auth_keys, line 2
SSH: restore_uid: 0/0
SSH: ssh_rsa_verify: signature correct
SSH: userauth_pubkey: authenticated 1 pkalg ssh-rsa
SSH: Entering interactive session for SSH2.
SSH: fd 5 setting O_NONBLOCK
SSH: fd 7 setting O_NONBLOCK
SSH: server_init_dispatch_20
SSH: server_input_channel_open: ctype session rchan 0 win 65536 max 16384
SSH: input_session_request
SSH: channel 0: new [server-session]
SSH: session_new: init
SSH: session_SSH: fd 9 is O_NSSH: Received SIGCHLD.
SSH: channel 0: request [EMAIL PROTECTED]

My original goal is to automate configuring an appliance which requires going 
into a certain modes first before you can issue the actual commands, sort of 
like 'conf t' in cisco.. Of course, aside from having to ssh or telnet to it 
first.

 Can you give me a very short code example.. As of this moment I'm still on 
page 6 of rfc 4251, hoping to find out what's with these channels and what am I 
really doing wrong. :-)

Thanks!







Reply via email to