knktc's Notes

python, cloud, linux...

0%

Fix "521 Data connections must be encrypted" in lftp over FTPS

When using lftp over FTPS, you may be able to log in successfully but still fail when transferring files:

Lftp put: Access failed: 521 Data connections must be encrypted.

This happens because lftp needs an extra setting to protect the data connection properly over FTPS.

Create an rc file under the current user’s .lftp directory, for example:

1
/root/.lftp/rc

Add this line:

1
set ftp:ssl-protect-data true

You can also add the same setting directly in your command or script:

1
lftp -u user ftp.test.com -e "set ftp:ssl-protect-data true;put -a file;exit"
如果我的文字帮到了您,那么可不可以请我喝罐可乐?