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

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

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

 



ogit2
Novice

Aug 9, 2017, 10:31 AM

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

Hi

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.


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

my $ftp_site = 'ftp.ftpsite.net';
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)
{
$ftp->ascii();
$ftp->put($ftpfile);
$ftp->quit();
}


Thank you.


Hi

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)


FishMonger
Veteran / Moderator

Aug 9, 2017, 2:13 PM

Post #2 of 5 (1271 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 http://search.cpan.org/~salva/Net-SSH2-0.66/lib/Net/SSH2.pm#scp_get_(_remote_path_[,_local_path_]_)

It uses the Net::SSH2::SFTP module for the file transfer. http://search.cpan.org/~salva/Net-SSH2-0.66/lib/Net/SSH2/SFTP.pm

Or, you can use Net::SFTP::Foreign either by itself or along with Net::SSh2.
http://search.cpan.org/~salva/Net-SFTP-Foreign-1.87/lib/Net/SFTP/Foreign.pm


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


ogit2
Novice

Aug 10, 2017, 7:53 AM

Post #3 of 5 (1262 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/Handle.pm 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


FishMonger
Veteran / Moderator

Aug 10, 2017, 8:10 AM

Post #4 of 5 (1259 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.


ogit2
Novice

Aug 10, 2017, 8:19 AM

Post #5 of 5 (1256 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