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.

4 thoughts on “Force SSH password on lftp”

  1. Hi, do you know how to auto-accept keys while connecting to the SFTP account for the first time? So I don’t have to enter ‘yes’

    1. You mean auto accept the host key? There’s probably an option you can pass to the SFTP process which will in turn be passed through to SSH. man sftp Yeah, you can pass -o and then options that’ll be passed to SSH. A quick search suggests this might work -oStrictHostKeyChecking=no, but I haven’t tested it…

  2. Thanks for this!! It worked for me trying to do a remote server to sftp server transfer. I was wondering how to prevent it from using my keys.

Leave a Reply

Your email address will not be published. Required fields are marked *