CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Beginner:
Secure FTP in Explicit Mode



Aug 9, 2017, 10:31 AM

Post #1 of 5 (2338 views)
Secure FTP in Explicit Mode Can't Post


We use Perl to do basic FTP but need to change this to

’Secure FTP with SLS/TLS – explicit mode’ and in passive mode

Is someone able to give us an example of how to do this please using Net::FTP or Net::FTPSSL . We have tried below and the connection fails to get a response from the server. We have searched google, but can only find 'chilkat' examples which don't seem to be standard perl.

We just need the right syntax to use.

#use Net::FTP;
use Net::FTPSSL;

my $ftp_site = '';
my $ftp_dir = 'in';
my $ftp_user = 'ftpuser';
my $ftp_password = 'ftppassword';
my $ftperr = 0;
my $ftpfile = 'file.csv';

my $ftp = Net::FTPSSL->new($ftp_site, Encryption => EXP_CRYPT) or $ftperr = 1;

if ($ftperr == 0)
$ftp->login($ftp_user, $ftp_password) or $ftperr = 2;

if ($ftperr == 0)
$ftp->cwd($ftp_dir) or $ftperr = 3;

if ($ftperr == 0)

Thank you.


Have you managed to look at this at all. We have found this article that may be useful? node id 868650 on perl monks.

Unfortunately, it mentioned using Net::SSH2 but when we tried CPAN Net::SSH2 that came back with unable to find working library of ssh2. Our provider is gogng to switch us off shortly so our only alternative would be to get a third party product to do the work unless we can crack this.

Hopefully this has been resolved somewhere

Thank you

(This post was edited by ogit2 on Sep 28, 2017, 6:03 AM)

Veteran / Moderator

Aug 9, 2017, 2:13 PM

Post #2 of 5 (2330 views)
Re: [ogit2] Secure FTP in Explicit Mode [In reply to] Can't Post

I haven't used Net::FTPSSL so I can't provide a working example using it.

Have you tried enabling debug mode?
What errors/warnings do you receive?

A more common module for this is Net::SSH2[,_local_path_]_)

It uses the Net::SSH2::SFTP module for the file transfer.

Or, you can use Net::SFTP::Foreign either by itself or along with Net::SSh2.

(This post was edited by FishMonger on Aug 9, 2017, 2:15 PM)


Aug 10, 2017, 7:53 AM

Post #3 of 5 (2321 views)
Re: [FishMonger] Secure FTP in Explicit Mode [In reply to] Can't Post

Thank you for the reply. The error we get is

connect: A connection attempt failed because the connected party did not properl
y respond after a period of time, or established connection failed because conne
cted host has failed to respond. at C:/Perl/lib/Net/SSLeay/ line 229.

We are trying to find some example code to use as we are not that perl savvy. Something that will ideally work without having to install additional modules. We could not find any simple FTP examples associated with NET:SSH2:SFTP. We have also tried installing Net::SFTP but that will not install on our Perl.

Thank you

Veteran / Moderator

Aug 10, 2017, 8:10 AM

Post #4 of 5 (2318 views)
Re: [ogit2] Secure FTP in Explicit Mode [In reply to] Can't Post

What version of perl are you using and is it ActiveState or Strawberry?

The example shown in the Net::SFTP::Foreign doc is simple.

If I can find enough free time today, I'll try to come up with a tested working example.


Aug 10, 2017, 8:19 AM

Post #5 of 5 (2315 views)
Re: [FishMonger] Secure FTP in Explicit Mode [In reply to] Can't Post

Thank you

We are using ActiveState and have successfully installed the Net::SFTP::Foreign module using CPAN.

A working example will be great.


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives