I ran into a few issues trying to use a non-default private key file with lftp. Here is how I got it to work:
inside ~/.lftprc put
set sftp:connect-program "ssh -p 23 -a -x -i /home/my_user/.ssh/key_name_here"
The important items are what is passed to the -i option – this should be the private key you want to use. In my example I’m also using a non-standard port (-p 23 for port 23)
To connect, run:
lftp -u your_user_name,blank sftp://your-server.org
For this to work you need to:
- specify sftp:// as the server type
- set the password to a junk value, I use “blank”