Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Comment on

( #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":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

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

    How do I use this? | Other CB clients
    Other Users?
    Others wandering the Monastery: (16)
    As of 2015-07-28 16:41 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









      Results (258 votes), past polls