Rhys has asked for the wisdom of the Perl Monks concerning the following question:
So there are currently two options if you want to use SCP in Perl:
- use Net::SCP; # Doesn't allow passwords.
- use Net::SCP::Expect; # Passwords okay.
So I need to scp the files /flash/config.cfg and /flash/boot.cfg from a bunch of switches - not servers - using SCP. I can get the switch IPs, user name, and password into the script, but then it starts to run into problems.
First, I can't use Net::SCP because I can't set up keys on the switches for logistical reasons. (Many users need to use this script and in addition to certain keygen limitations on the switch, I don't want to maintain that many keypairs).
Second, Net::SCP::Expect seems to croak() after the first (successful) file transfer, and I'm having a tough time figuring out why it isn't working. There are some errors that appear, but they pile on top of each other on one line.
To complicate matters, every time one of these switches gets rebooted, the host key is regenerated. Messy...
Anyway, Net::SCP::Expect does have an error_handler method that takes a coderef, but it's unclear on what exactly is passed to that sub. I'm about to try Data::Dumper on @_ to see.
Any other ideas or suggestions? Anybody have any direct experience with this kind of thing and either Net::SCP or Net::SCP::Expect?
--J
Update: Added tags to highlight the fact that I am not using SCP to talk to a unix host, which is the source of most of the limitations in this problem.
Update 2: This has been solved. See below or click the link.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Using Perl to do SCP
by Rhys (Pilgrim) on Sep 15, 2004 at 16:03 UTC | |
Re: Using Perl to do SCP
by idsfa (Vicar) on Sep 15, 2004 at 15:45 UTC | |
by Rhys (Pilgrim) on Sep 15, 2004 at 15:52 UTC | |
Re: Using Perl to do SCP
by itub (Priest) on Sep 15, 2004 at 15:21 UTC | |
by Rhys (Pilgrim) on Sep 15, 2004 at 21:20 UTC | |
Re: Using Perl to do SCP
by Roger (Parson) on Sep 15, 2004 at 15:14 UTC | |
by Rhys (Pilgrim) on Sep 15, 2004 at 15:50 UTC | |
Re: Using Perl to do SCP
by tradez (Pilgrim) on Sep 15, 2004 at 18:47 UTC | |
by Rhys (Pilgrim) on Sep 15, 2004 at 21:18 UTC | |
Re: Using Perl to do SCP
by Anonymous Monk on Sep 15, 2010 at 11:11 UTC |