Friday, July 30, 2010

lftp error "Delaying before reconnect"

lftp is a well-known ftp client.  I use it with both MacOSX and Grml Linux.

Few days ago I had to download all files from a virtual host directory which resides in a shared hosting environment.  A bad thing about using these cheap shared hostings is that it provides us ftp to be the only mean of file transferring which sucks.  (When possible, I would rather go with sftp, rsync or fully shell access where there are a whole bunch of other fancy ways to choose from.)

I searched on Google to find any alternative ways (other than lftp) to sync files from ftp site to my local directory instead of having to download the whole files again and again which is too expensive.  (By synchronizing I mean to fetch only newer or modified files on the next synchronizations.) (which lftp's man page does not state precisely whether it can do it or not so I assume it can't.) Unfortunately, I couldn't find an OpenSource one for Linux.  I could see only proprietary softwares for both Windows and Linux.  If anyone can suggest me for Linux, please do.  I know WinSCP for Windows is free-to-use and supports synchronization but I need one for Linux.

OK.  So it seemed I had no other choices.  I had to go with lftp to download the whole files to my local disk then.

As usual, I logged on to the ftp server with lftp, switched to the directory I wanted (in my case it was public_html/), then issued "mirror" command.  Unfortunately, I got this error:

[Delaying before reconnect: 57]  

I then pressed ctrl+c and tried "ls" and this is what I got: 

[lftp 4.0.2] someuser@somehost ~ % ls
`ls' at 0 [Delaying before reconnect: 57]  

I was like #wtf (oops!).  I then turned debugging mode of lftp on.  With the error message I got from running lftp in debugging mode, I then found out (from Google) that if I ran into that mysterious problem, I should try:

set ftp:ssl-allow no

And it just worked....!  Now I can use both mirror and ls and assumably everything... ha ha

Note that as I am just a lazy nerd so I didn't go further to find out why we need to unset that ssl-allow property : P  I would greatly appreciate if anyone can tell me why : )

Recommended Softwares

11 comments:

flexicurity said...

Thanks!

I've been trying for several hours to connect using lftp, but now with your post all perfect.

unsigned_nerd said...

i'm glad to hear that, flexicurity!

Anonymous said...

Great! It solved the problem for me, too. Thanks!
Georgem

Anonymous said...

Sorry i am new to this but i to need this solution, can you please show where to use that set ftp:ssl-allow no

Anonymous said...

hello i need solution urgently pleaseee

unsigned_nerd said...

use it inside the lftp shell

Anonymous said...

ok, i had this issue just now and could fix it.

thing is, if you want to use ssl/tls (switching it off wasnt a solution for me), you either have to activate passive mode or use active mode.

with passive mode it should work just fine (usually used if you're behind a nat..). if you want to use active, you have to configure portmaps on your router and write your internet ip in the lftp config.

as an example, here is my user config (~/.lftp/rc) with active ftp mode (and obviously port 8040-8050 portmapped in the router):

set ftp:passive-mode off
set ftp:port-ipv4
set ftp:port-range 8040-8050

with passive-mode on, it's easier and you dont have to check for your ip on every use ;)

even though the blog entry is a little bit old, i wanted to post here, because its ranked quite high in the google search for the delay problem.

on questions, or if i am somehow wrong, here is my email: micjar@web.de (i will post this "anonymous")

Anonymous said...

hi

the set the debug mode to 5
and also applied "set ftp:ssl-allow no"
but m still getting the same error and also the statement
"Socket error (Connection refused) - reconnecting"

Anonymous said...

Thanks

Ajay Patil said...

Check iptables rule at server end..

Ray Terry said...

thx, had this issue several times

Post a Comment