Force SSH password on lftp

When trying to connect to an sftp server in lftp, it automatically tries public key authentication first. In my case, because I have so many keys, I usually get “too many authentication failures” before it gets around to trying the password. Took me a while to find the solution, but it turns out to be fairly simple.

Once lftp is running, simply issue this command:

set sftp:connect-program "ssh -a -x -o PubkeyAuthentication=false"

This causes ssh to be run with public key authentication disabled, so it tries the password immediately, and succeeds. Yay. :-) Posting here for future reference.

lftp and cPanel

I routinely have problems connecting to cPanel FTP servers with lftp. Much to my frustration it works fine through gFTP. After some debugging investigation it seems that lftp automatically tries to use AUTH TLS and then fails. There is a simple solution. Set the lftp setting “ftp:ssl-allow” to false. This can be done by running this command within lftp:

set ftp:ssl-allow false