Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

Hi Perl monks

I have a requirement where i need to connect to 900 routers and execute few commands and capture the output. I am using Net::OpenSSH module for fulfilling my requirement. But we have ssh key authentication issue that is causing a problem for me. I cant manually connect to 900 servers to establish the SSH key. Is there a method for me to tackle it in script. The script given below is being used to connect to 1 router and execute the command

#!/usr/bin/perl use strict; use warnings; use Net::OpenSSH; my ($ssh,$password); my $host = ""; my $user_name = q(username); $password = q(My_Password); $ssh = Net::OpenSSH->new($host, user => $user_name, password => $passw +ord); my $output = $ssh->system("show isis neighbors") or die "remote command failed: " . $ssh->error; print "output is = $output\n";

In reply to SSH connection to 100 routers by vasanth.easyrider

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 or How to display code and escape characters are good places to start.
Log In?

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2022-01-19 09:56 GMT
Find Nodes?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:

    Results (55 votes). Check out past polls.