Help with Net::SSH::Perl
am 25.08.2006 20:26:30 von vhsrHi
Have any of you run into any issues like the one I am
having running the Net::SSH::Perl module? I installed
it without any issues following recommendations for
pre-requisites. I turned on debugging, and it is
stopping ssh connection at this point:
Connection closed by remote host. at
/usr/local/lib/perl5/site_perl/5.8.8/Net/SSH/Perl/AuthMgr.pm
line 43
The script I have is this:
#!/usr/local/bin/perl -w
@F5 = ( 'devicename' );
@ident = ( '/.root/.ssh2/root_system' );
%args = ( port => 22, protocol => 2, identity_files =>
\@ident, debug => 1);
%sftp_args = ( ssh_args => [%args] );
$workdir='/myfiles';
use Net::SSH::Perl;
use Net::SFTP;
foreach $bigip ( @F5 ) {
my $conn = Net::SSH::Perl -> new(
"$bigip.domain.com", %args );
$conn -> login('root');
( $stdout, $stderr, $exit ) = $conn -> cmd('bigpipe
config save /root/backup/
`hostname`-`date +%m%d%y%H%M`');
#
print "\$stdout: $stdout!\n\$stderr:
$stderr!\n\$exit: $exit!\n";
if ( ($stderr =~ m/config save request.../) && (!
$exit ) ) {
( $stdout, $stderr, $exit ) = $conn -> cmd('ls
/root/backup');
chomp $stdout;
$conn -> cmd('exit');
my $sftp = Net::SFTP -> new("$bigip.domain.com",
user => 'root', %sftp_ar
gs);
$sftp -> get("/root/backup/$stdout",
"$workdir/$stdout");
$sftp -> do_remove("/root/backup/$stdout");
}
--
I copied the public key from my system to device, I
can ssh from command line to device fine using the
keys, but I am having problem automating the process
via the script above. The script works fine on another
system I inherited (do not know what else could have
been modified, etc).
help is greatly appreciated.
Thanks
Running Solaris 9 on sparc server