<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
p.msonormal0, li.msonormal0, div.msonormal0
{mso-style-name:msonormal;
mso-margin-top-alt:auto;
margin-right:0in;
mso-margin-bottom-alt:auto;
margin-left:0in;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
span.EmailStyle19
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal">OK I believe I have this sorted. Thanks to those that responded.<br>
<br>
It appears we have to do ftps explicit vs implicit. Testing via WinSCP helped confirm that.<br>
<br>
The script for running this in cron still needs to be finalized but I’m sharing what I have at this point for lftp to get ftps. This is on RHEL6 by the way.
<br>
<br>
Some notes for the archives:<br>
For lftp below: -d = debug, -v = verbose, -c = command<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"># List specific file - Single command line<o:p></o:p></p>
<p class="MsoNormal">lftp -dv -c 'open -e set ftp:ssl-force true; set ftp:ssl-protect-data true; set ssl:verify-certificate false;open ftps://<USER>:<PASSWORD>@<URL>; ls <subdir>/<filename>'<br>
In the above one can add multiple set commands separated by semicolon. <br>
<br>
<o:p></o:p></p>
<p class="MsoNormal"># List all files in a directory - Single command line<o:p></o:p></p>
<p class="MsoNormal">lftp -dv -c 'open -e set ftp:ssl-force true; set ftp:ssl-protect-data true; set ssl:verify-certificate false;open ftps://<USER>:<PASSWORD>@<URL>; ls <subdir>/*'<o:p></o:p></p>
<p class="MsoNormal"><br>
# List all files in a directory – using multiple rather than single lines (start/end with double quote) for scripting. Specify port to use (21 = default for explicit, 990 = default for implicit, some partners specify alternate ports for these). Note space
used between user and password rather than colon. Also URL here does NOT start with “ftps://” just the site name. Use the name rather than IP because the SSL is issued to name (or set the option to ignore SSL errors.)<o:p></o:p></p>
<p class="MsoNormal">lftp -dv -c "<o:p></o:p></p>
<p class="MsoNormal">set ftp:ssl-force true<o:p></o:p></p>
<p class="MsoNormal">set ftp:ssl-protect-data true<o:p></o:p></p>
<p class="MsoNormal">set ssl:verify-certificate false<o:p></o:p></p>
<p class="MsoNormal">open <URL>:21<o:p></o:p></p>
<p class="MsoNormal">user <USER> <PASSWORD><o:p></o:p></p>
<p class="MsoNormal">ls <subdir>/*<o:p></o:p></p>
<p class="MsoNormal">bye<br>
“<br>
<br>
# List all files in a directory - Multiple lines with variables<o:p></o:p></p>
<p class="MsoNormal">## Set the variables<o:p></o:p></p>
<p class="MsoNormal">REMHOST=<URL><o:p></o:p></p>
<p class="MsoNormal">REMPORT=21<o:p></o:p></p>
<p class="MsoNormal">REMUSER=<USER><o:p></o:p></p>
<p class="MsoNormal">REMPASS=<PASSWORD><o:p></o:p></p>
<p class="MsoNormal">REMDIR=<subdir><o:p></o:p></p>
<p class="MsoNormal">## Use the variables<o:p></o:p></p>
<p class="MsoNormal">lftp -dv -c "<o:p></o:p></p>
<p class="MsoNormal">set ftp:ssl-force true<o:p></o:p></p>
<p class="MsoNormal">set ftp:ssl-protect-data true<o:p></o:p></p>
<p class="MsoNormal">set ssl:verify-certificate false<o:p></o:p></p>
<p class="MsoNormal">open $REMHOST:$REMPORT<o:p></o:p></p>
<p class="MsoNormal">user $REMUSER $REMPASS<o:p></o:p></p>
<p class="MsoNormal">ls $REMDIR/ *<o:p></o:p></p>
<p class="MsoNormal">bye<o:p></o:p></p>
<p class="MsoNormal">"<o:p></o:p></p>
<p class="MsoNormal"><br>
<br>
# List all files in a directory using variables. Also get one of the files. (Note mget works for multiple files instead of get used for single file.)<o:p></o:p></p>
<p class="MsoNormal"># Set the variables<o:p></o:p></p>
<p class="MsoNormal"># List all files in a directory - Multiple lines with variables<o:p></o:p></p>
<p class="MsoNormal">## Set the variables<o:p></o:p></p>
<p class="MsoNormal">REMHOST=<URL><o:p></o:p></p>
<p class="MsoNormal">REMPORT=21<o:p></o:p></p>
<p class="MsoNormal">REMUSER=<USER><o:p></o:p></p>
<p class="MsoNormal">REMPASS=<PASSWORD><o:p></o:p></p>
<p class="MsoNormal">REMDIR=<subdir><o:p></o:p></p>
<p class="MsoNormal">## Use the variables<o:p></o:p></p>
<p class="MsoNormal">lftp -dv -c "<o:p></o:p></p>
<p class="MsoNormal">set ftp:ssl-force true<o:p></o:p></p>
<p class="MsoNormal">set ftp:ssl-protect-data true<o:p></o:p></p>
<p class="MsoNormal">set ssl:verify-certificate false<o:p></o:p></p>
<p class="MsoNormal">open $REMHOST:$REMPORT<o:p></o:p></p>
<p class="MsoNormal">user $REMUSER $REMPASS<o:p></o:p></p>
<p class="MsoNormal">ls $REMDIR/ *<o:p></o:p></p>
<p class="MsoNormal">get $REMDIR/<filename><o:p></o:p></p>
<p class="MsoNormal">bye<o:p></o:p></p>
<p class="MsoNormal">"<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><b>From:</b> Boris Borisov <bugyatl@gmail.com> <br>
<b>Sent:</b> Monday, December 03, 2018 3:08 PM<br>
<b>To:</b> Lightner, Jeffrey <JLightner@dsservices.com>; Atlanta Linux Enthusiasts <ale@ale.org><br>
<b>Subject:</b> Re: [ale] Any ftps / lftp experts?<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">Not expert on ftp but what about for passive or ftp active mode.<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">I service a vendor for whom ftp active mode would not work. Ftp client has to be set explicitly in passive mode.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Maybe I'm shooting in the dark in your case.<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal">On Mon, Dec 3, 2018, 2:56 PM Lightner, Jeffrey via Ale <<a href="mailto:ale@ale.org">ale@ale.org</a> wrote:<o:p></o:p></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">We have a new partner insisting they can only accept ftps (i.e. no sftp) logins for us to download files from their site.<br>
<br>
I had found some time ago that the tool lftp can be used to login to ftps sites and had worked out a syntax that worked for one vendor.<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">On trying that syntax on this site it doesn’t work. I found an alternate syntax on RedHat’s site and that worked for me (once) on 16-Nov to actually download files.<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">However, ever since then every time I try the newer syntax it fails. Worse yet they lock the vendor is locking the account after 3 failed password attempts (which they says is
the only reason) so every time I try this syntax the account is getting locked and I have to wait for them to unlock it. Prior to running the syntax just doing a simple login works but of course doesn’t afterwards. It appears the way lftp works is that
even though one gives it the user/login at start it is actually logging in separately for each command it runs.<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">The basic command syntax here logs in successfully (until the account gets locked):<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">lftp -d -u <USER>,<PASSWORD> <ftpssite><br>
<br>
That puts me at an lftp prompt. At that prompt I can send commands to change directory, list files, and even change the password. However, if I try a “get <file>” it just times out and retries over and over.<br>
<br>
The syntax (one liner) that worked for me on 16-Nov that now fails:<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;margin-bottom:12.0pt">lftp -v -c 'open -e "set ftps:initial-prot """; set ftp:ssl-force true; set ftp:ssl-protect-data true; set ssl:verify-certificate false; open ftps://<USER>:<PASSWORD>@<ftpssite>; ls;
cd outbound/<subdir>; ls; get <filename>'<br>
<br>
I had later found things such as specifying port and also that the “set ftp:inititial-prot” was unsupported (I’d seen an error in output using it even though it had been successful downloading.) I’d added the port option and removed the unsupported option
that same day and they had worked but later in day the account was locked so further testing failed. After having partner unlock I did additional testing but eventually it gets locked so I’ve never yet been able to download a file despite initial connections
being successful.<br>
<br>
Every time partner unlocks the account the basic login works:<br>
lftp -d -u <USER>,<PASSWORD> <ftpssite><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">But every time I try to use the expanded syntax the account gets locked again. I can see it is showing failed login multiple times in the output but don’t know why it is doing
that now when it worked previously.<br>
<br>
I need to be able to script this so that we can login to the server with the user and password to see what files, if any, are available to download, then download the ones found. This kind of operation is something I’ve done in the past with regular here
docs for regular ftp and with perl with ftp as well as scripts for sftp.<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Does anyone have syntax that works for similar purposes that would be willing to share? I’m not married to the idea of lftp – that is just what I find suggested in most posts.
Is there a way to do it with wget? curl? Some other CLI tool?<br>
<br>
Remote only supports ftps – please don’t suggest sftp as that is simply not an option.<o:p></o:p></p>
</div>
<p style="line-height:10.0pt"><span style="font-size:10.0pt;font-family:"Arial",sans-serif">CONFIDENTIALITY NOTICE: This e-mail may contain privileged or confidential information and is for the sole use of the intended recipient(s). If you are not the intended
recipient, any disclosure, copying, distribution, or use of the contents of this information is prohibited and may be unlawful. If you have received this electronic transmission in error, please reply immediately to the sender that you have received the message
in error, and delete it. Thank you <o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt"><o:p> </o:p></p>
</div>
<p class="MsoNormal">_______________________________________________<br>
Ale mailing list<br>
<a href="mailto:Ale@ale.org" target="_blank">Ale@ale.org</a><br>
<a href="https://mail.ale.org/mailman/listinfo/ale" target="_blank">https://mail.ale.org/mailman/listinfo/ale</a><br>
See JOBS, ANNOUNCE and SCHOOLS lists at<br>
<a href="http://mail.ale.org/mailman/listinfo" target="_blank">http://mail.ale.org/mailman/listinfo</a><o:p></o:p></p>
</blockquote>
</div>
</div>
</body>
</html>