It’s surprisingly obscure how to use a commandline FTP client on Linux with SSL encryption. As far as I know the standard FTP client can’t do it but lftp supports SSL. It’s easy to connect to a SSL encrypted FTP server by just calling the lftp command and you can provide the user name as a parameter:

lftp -u username ftp.server.net

If the server uses a self-signed certificate you need to provide the setting “set ssl:verify-certificate no” that you can save to “~/.lftprc”.

lftp can handle the FTP, FTPS, HTTP, HTTPS, HFTP, FISH and SFTP protocols. More info can be found in the lftp manpage.

Another interesting option of lftp is the capability of batch processing. After the switch “-c” lftp expect a series of command that can be separated with a semicolon (;), AND (&&) or OR (||).

To debug connection problems with FTP over SSL you can use the openssl command, like this:

openssl s_client -connect ftp.server.net:21 -starttls ftp