http://qs321.pair.com?node_id=1232405

CaptainK9 has asked for the wisdom of the Perl Monks concerning the following question:

Hey there,

I have a perl script that is taking some files off a server - renaming some files - and putting them on a remote ftp server.

This script originally written by someone else, I'm just trying to make it work again after some updates.

Currently, my script fails with this error.

No matching cipher found: client 3des-cbc,blowfish-cbc,arcfour server aes256-ctr,aes192-ctr,aes128-ctr at /usr/local/share/perl5/Net/SSH/Perl/SSH2.pm line 92.

I have tried modifying the ~/.ssh/config file with different Ciphers but I cannot seem to make that work no matter what I put in there.

I was told to use Net::SFTP::Foreign instead of Net::SFTP (line 15)

Whenever I use this instead my script dies with "Not a HASH reference at /root/backup/backswitch.pl line 20."

Is there a way to modify that line to make it work with the newer SFTP::Foreign - I'm not against doing it either way as long as it works.

Thanks for your help I greatly appreciate it.

#!/usr/bin/perl -w require 5.002; use Net::SFTP; use Net::FTP; use Net::SFTP::Foreign; use warnings; my ($i,$all,%arg,$host,$path); %arg = ( user => "username", password=> "password", ); $host="1.1.1.1"; my $sftp = Net::SFTP::Foreign->new($host,%arg); my $ftp = Net::FTP->new("1.1.1.1",Port=>21) or die "Cannot connect to +1.1.1.1"; $ftp->login("username","password"); foreach $i ($sftp->ls(".")){ $fname=$i->{filename}; if ($fname=~ m/.pri$/){ $rname="/home/location/$fname"; if (-e $rname){ }else{ push @fields,$fname ; } } } foreach $i( @fields){ $sftp->get($i,"/home/msbill1/$i"); $ftp->put("/home/msbill1/$i","/tocustomer/$i"); ($t,undef)=split '.pri',$i; $t=$t.".scd"; # print "$t \n"; $sftp->do_rename($i,$t); }