Discussion:
SFTP connection hangs... where to look?
Tony Eva
2013-07-03 14:09:01 UTC
Permalink
I've cross-compiled lftp 4.4.8 for a MIPS64-based embedded system using
buildroot (configured with --without-gnutls --with-openssl).

(Incidentally, the unmodified configure script does not work for a
cross-compiled system because the test for posix_fallocate() support
requires the execution of a test program, which is obviously not possible
when cross-compiling. So I just hardcoded that to 'yes'.)

The resulting lftp executable appears to work on the target OK with remote
FTP servers - I can connect, get files, get directory listings and so on.

However when I try to connect to a remote SFTP server, after entering the
userid and password, if I try 'ls' the prompt status says 'connecting' and
it stays like that for ever. I can ^C to abort it, but any command that
needs to connect to the remote server just does the same thing again.

I'm not really sure where to start looking for the problem ... any
assistance would be much appreciated.
--
Tony
Alexander V. Lukyanov
2013-07-04 07:42:43 UTC
Permalink
Post by Tony Eva
However when I try to connect to a remote SFTP server, after entering the
userid and password, if I try 'ls' the prompt status says 'connecting' and
it stays like that for ever. I can ^C to abort it, but any command that
needs to connect to the remote server just does the same thing again.
Try to turn on debug in lftp, it can help to understand the problem.
Can you connect to the target server with ssh?
--
Alexander.
Tony Eva
2013-07-04 11:02:15 UTC
Permalink
Post by Alexander V. Lukyanov
Try to turn on debug in lftp, it can help to understand the problem.
Can you connect to the target server with ssh?
Thanks for the suggestions - by turning debug on and trying ssh separately
I found that the issue was because the remote host's key is not in the
.ssh/known_hosts file and ssh was prompting for it to be added - since lftp
hides the underlying ssh commands/responses there was no indication of this.

For various reasons it's not possible for us to preload known_hosts with
the relevant key, and this machine runs unattended, but I just added 'set
sftp:connect-program ssh -y' to lftp.conf (ssh is provided by dropbear) and
the issue is now resolved.

Thanks again for your quick reply.
--
Tony
Loading...