Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

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); }

In reply to Modifying Script From Net::SFTP to Net::SFTP::Foreign by CaptainK9

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (5)
As of 2024-03-28 18:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found