Transfer files using lftp
, automation | ftp
I needed ftps in order to move files from one server to another. Lftp is a 'swiss army knife' program for sophisticated file transfer. Connecting to a server is done by the following:
lftp -p [port_number] -u [username] [site]
lftp -p 2121 -u nice_user nice_server.com
When connected in the lftp console the following can be set to enable explicit ftps data protection:
set ftp:ssl-force true
set ftp:ssl-protect-data true
set ssl:verify-certificate off
Note that verify-certificate is needed if the server crt is not installed correctly. When the connection is working as expected, then the entire thing can be automated by used of the lftp script feature.
lftp -f [path_to_script_file]
The above connection setup can be combined into a script:
open -p 2121 -u nice_user nice_server.com
set ftp:ssl-force true
set ftp:ssl-protect-data true
set ssl:verify-certificate off
dir
For passwordless connection add the password into the script such as '-u nice_user,nice_password'. For more scripting read the man page of lftp.

Links