lftp does not connect to SFTP (even after asking for password)

2.4k Views Asked by At

I've been trying to use lftp over SFTP but I somehow can't get it to connect properly.

I issue the command (which as far as I can tell is the same as the one for sftp), lftp prompts me for the password, which I input, and the lftp prompt appears! This all seems good, but I can't do anything afterwards.

Here's an illustration:

myuser $ lftp [email protected]                                                                                                                                    
Password: 
lftp [email protected]:~> ls                   
`ls' at 0 [Connecting...]  

and then it gets stuck there. Note that if I issue sftp [email protected] and input the password everything works flawlessly. Am I missing something obvious?

I'm using lftp version 4.9.2.

2

There are 2 best solutions below

0
Martin Prikryl On

The lftp is primarily an FTP client. If you want it to use SFTP, you have to tell it so:

lftp sftp://[email protected]
0
mwfearnley On

I was seeing this problem because I tried using lftp without trying sftp or ssh first.

The latter programs were prompting me to accept an SSH fingerprint. But lftp was suppressing this prompt, and just showing `ls' at 0 [Connecting...] forever.

I had to attempt a connection with ssh/sftp first and accept the fingerprint, which added it to my ~/.ssh/known_hosts file. After this, lftp sftp://... could connect fine.