Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Hello,

My perl script has to connect a dlink switch and get config back to a tftp server.

Here's the connexion log :

tri-srv-jh: Reading configuration data /home/julian/.ssh/config tri-srv-jh: Reading configuration data /etc/ssh_config tri-srv-jh: Connecting to 10.0.0.30, port 22. tri-srv-jh: Remote protocol version 2.0, remote software version DLINK + Corp. SSH server ver 1.00.000 tri-srv-jh: Net::SSH::Perl Version 1.34, protocol version 2.0. tri-srv-jh: No compat match: DLINK Corp. SSH server ver 1.00.000. tri-srv-jh: Connection established. tri-srv-jh: Sent key-exchange init (KEXINIT), wait response. tri-srv-jh: Algorithms, c->s: 3des-cbc hmac-sha1 none tri-srv-jh: Algorithms, s->c: 3des-cbc hmac-sha1 none tri-srv-jh: Entering Diffie-Hellman Group 1 key exchange. tri-srv-jh: Sent DH public key, waiting for reply. tri-srv-jh: Received host key, type 'ssh-dss'. tri-srv-jh: Host '10.0.0.30' is known and matches the host key. tri-srv-jh: Computing shared secret key. tri-srv-jh: Verifying server signature. tri-srv-jh: Waiting for NEWKEYS message. tri-srv-jh: Send NEWKEYS. tri-srv-jh: Enabling encryption/MAC/compression. tri-srv-jh: Sending request for user-authentication service. tri-srv-jh: Service accepted: ssh-userauth. tri-srv-jh: Trying empty user-authentication request. tri-srv-jh: Authentication methods that can continue: password. tri-srv-jh: Next method to try is password. tri-srv-jh: Trying password authentication. tri-srv-jh: Login completed, opening dummy shell channel. tri-srv-jh: channel 0: new [client-session] tri-srv-jh: Requesting channel_open for channel 0. tri-srv-jh: channel 0: open confirm rwindow 10000 rmax 8192 tri-srv-jh: Got channel open confirmation, requesting shell. tri-srv-jh: Requesting service shell on channel 0. tri-srv-jh: channel 1: new [client-session] tri-srv-jh: Requesting channel_open for channel 1. tri-srv-jh: Entering interactive session. ^C

As you can see, I have to do a ctrl+c to leave session. In fact, after "Entering interactive session." ... nothing, the abyss.

I tryed a lot of things to send my command, but noway :(

Here's my source code :

sub Recup_dlink_DGS { #$ssh = Net::SSH::Perl -> new(@switch_details[1]); #$ssh->login(@switch_details[4], @switch_details[3]); #$ssh->cmd("upload cfg_toTFTP $serveur_tftp @switch_details[2] +")"; #sleep 2; #$cmd = "upload cfg_toTFTP $serveur_tftp @switch_details[2]"; my %params = ( protocol => 2, debug => "true"); $ssh = Net::SSH::Perl->new(@switch_details[1], %params); $ssh->login(@switch_details[4], @switch_details[3]); #my ($stdout, $stderr, $exit) = $ssh->cmd($cmd); #print $stdout . "\n"; #print $stderr . "\n"; #print $exit . "\n"; $ssh->cmd("upload cfg_toTFTP $serveur_tftp @switch_details[2]" +); #&controle_cfg; #return 1; }

Can you help me please ? You have to know that i can't use telnet or expect for the moment.

Many thanks

j.

In reply to net::ssh::perl : no way to send cmd ! by coldroom

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (4)
As of 2024-04-25 22:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found