Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

comment on

( #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/ 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/ 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=""; my $sftp = Net::SFTP::Foreign->new($host,%arg); my $ftp = Net::FTP->new("",Port=>21) or die "Cannot connect to +"; $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

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

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

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

    How do I use this? | Other CB clients
    Other Users?
    Others taking refuge in the Monastery: (5)
    As of 2020-08-06 07:02 GMT
    Find Nodes?
      Voting Booth?
      Which rocket would you take to Mars?

      Results (38 votes). Check out past polls.