Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using Net::SSH to contact Cisco Routers 1

Status
Not open for further replies.

netman4u

Technical User
Mar 16, 2005
176
US
Anyone have any sample code for using Net:SSH to connect to and run a sho command?

Net:SSH does not seem to have a way to pass a password to log in and expects a certificate. On my test router I SSH to it and it asks me for a username and password so I do not think Net:SSH will work. I also cannot use Net:SSH::perl as I am using a windows system.

Anyone have any command line examples that work? I dug this up on this forum:

Code:
my $password = 'password';
my $user = 'user_a';
my $ip = '100.100.201.22';
my $results=`"(echo $password) | ssh $user@$ip"`;

But it does not work I am still prompted for a password.

Any ideas?

Thanks,

Nick


If at first you don't succeed, don't try skydiving.
 
Code:
C:\Document and Settings\Ax>perl -MCPAN -e shell
[b][u]cpan>[/u][/b]install Net::SSH::Perl

What makes you think Net::SSH::perl won't work under windows?

Paul
------------------------------------
Spend an hour a week on CPAN, helps cure all known programming ailments ;-)
 
Thanks for the reply Paul. I am testing on windows using Active State Perl. My program will eventually run on a Solaris 9 system. I know the Net::SSH::perl will probably do the job as it allows a password however it requires the installation of a large quantity of Crypt modules as well as the Math::pari program and other libraries.

Suffice it to say that I tried going that route in my dev environment but could not get the Math::pari compiled. My Solaris systems have no access to the internet to allow the use of MCPAN and I am not allowed to install any libraries on the systems and it takes weeks if your lucky here to get the unix admins to install them.


That being said, can anyone help me with SSH to cisco devices that require password authentication?


If at first you don't succeed, don't try skydiving.
 
try using PuTTy to cache the cert of the router?

Paul
------------------------------------
Spend an hour a week on CPAN, helps cure all known programming ailments ;-)
 
it's good for replacing windows also ;-)

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you.
 
I have been told that the cert will be cached on my Solaris system. What we have here is a lack of understanding on my part of how Cisco SSH works. I did not know that Cisco had a way of implementing certifications as I was prompted for a password when "SSHing" to the routers. If I had the proper cert I would not have to.

My apologies.

If at first you don't succeed, don't try skydiving.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top