I'm using lftp to send files to a sftp server, but i don't how to connect with key and passphrase.
So in sftp, I can do this :
sftp -i .ssh/id_rsa.mykey login@my.host.fr
Enter passphrase for key '.ssh/id_rsa.mykey': my passphrase here
So, how can I using lftp with this connecting method ?
Just add:
to your
~/.lftprc
, as most of the settings can be set permanently there.LFTP doesn't seem to pass or does not use the identity file specified with "ssl:key-file" with SSH, you have to specify it in the sftp:connect-program option: "ssh -a -x -i yourprivatekeyfile"
This should work.
You must specify the username, and just pass anything as the password, to skip it asking.
An answer based off Jean-Luc Boss's and wiak's, but a bit more explicit:
To connect to a server,
lftp
uses anssh
command, by defaultssh -a -x
. It doesn't have an explicit option for changing the keyfile to use, but as you note,ssh
does, so we just need to setlftp
to connect usingssh -a -x -i <keyfile>
before it connects.You can do this in a few ways:
If you're using lftp's interactive command line, run the following command before you connect:
If you're specifying a bunch of commands to
lftp
using-c
, just add that set command to the start of your command sequence:If you always going to want to use the same key, just add that
set ...
line from the first bullet to your~/.lftprc
file (or one of the other configuration file options listed inman lftp
).