vasanth.easyrider has asked for the wisdom of the Perl Monks concerning the following question:
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 = "10.0.0.183"; 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";
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: SSH connection to 100 routers
by thanos1983 (Parson) on Feb 23, 2018 at 11:23 UTC | |
Re: SSH connection to 100 routers
by karlgoethebier (Abbot) on Feb 24, 2018 at 11:26 UTC | |
Re: SSH connection to 100 routers
by eighty-one (Curate) on Feb 26, 2018 at 15:06 UTC | |
Re: SSH connection to 100 routers
by Anonymous Monk on Feb 26, 2018 at 14:44 UTC |
Back to
Seekers of Perl Wisdom