Cannot connect lftp to IIS FTP using SSL

I have setup lftp on an Ubuntu server and I'm trying to connect to IIS FTP. In IIS, it is configured with a self-signed certificate and Ok with an explicit SSL option is connected using WinSCP. But using the lftp command, although it connects when I enter the cat files or get [filename] command, I get the error 534 protection level negotiation failed

A command like cd [foldername] works fine. I can’t understand what’s wrong. Does lftp require a specific option for this case?

+5
source share
1 answer

After experimenting with lftp I submit the solution using a bash script. So the contents of the bash script file will be

 #!/bin/bash USER='username' PASS='password' HOST='ftp.mydomain.com' LOCAL_BACKUP_DIR='/backups' REMOTE_DIR='/backupfiles' lftp -u $USER,$PASS $HOST <<EOF set ftp:ssl-protect-data true set ftp:ssl-force true set ssl:verify-certificate no mirror -R -e "$LOCAL_BACKUP_DIR" "$REMOTE_DIR" quit EOF 

When changing the first part with the appropriate parameters of your ftp host, this script will display a mirror of all the files in the local directory on the remote.

Since the remote host is a Windows IIS FTP server with a self-signed certificate configured, I should note the need for the set ssl:verify-certificate no in the script. In addition, although the IIS / FTP user must be entered in the form of HOST | USER, for example. ftp.mydomain.com | username, for some reason, if this is set in the USER lftp parameter, authentication fails. You have to omit the HOST name and just set the username ... and so it successfully connects.

+4
source

All Articles