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

23 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"

Unknown said...

Check iptables rule at server end..

Unknown said...

thx, had this issue several times

Anonymous said...

Super.
This trick help me.

Pomogło

David Provost said...

lftp can only fetch new files with the following operators:
--only-newer --ignore-time
therefore, to download only new file:
mirror --only-newer --ignore-time
You can exclude folders as well, lets say you are doing an upload, but want to ignore your assets folder, and only upload new files:
mirror -R --only-newer --ignore-time --exclude ASSETS/

To connect using plain ftp, the following is a one liner:
lftp -e "set ftp:ssl-allow off;" -u userName,passWord -p 21 74.50.ip.address/orURLhere

Fighter Wing said...

Thanks, good article!

Ashok said...

Hi All,

Am also facing the same issue and the said solution didnt work for me. fyi I am executing the command on cygwin on windows environment. I noticed the at the time of lftp command execution its looking for ssh which am afraid not installed on the cygwin. Please advice.

thanks.

unsigned_nerd said...

Hi Ashok, Did you install ssh client on cygwin yet?

Anjaneya Swami Statue said...

where i need to update below parameter,plz specify the location..i was facing this prom from 2months,but i dint get sol..plz help me ..

set ftp:ssl-allow no

Anjaneya Swami Statue said...

this is the prob :

lftp haritha@CITRIXSVR:~> ls
`ls' at 0 [Delaying before reconnect: 8]

`ls' at 0 [Delaying before reconnect: 6]

`ls' at 0 [Delaying before reconnect: 5]


thanks
Rao

Anonymous said...

Thank !

Koningenart said...

It is really a helpful blog to find some different source to add my knowledge. I came into aware of new professional blog and I am impressed with suggestions of author.
เคส Oppo A37

Anonymous said...

It is really a helpful blog to find some different source to add my knowledge. I came into aware of new professional blog and I am impressed with suggestions of author.

Devadatta said...

systemctl enable vsftpd
systemctl start vsftpd

Anonymous said...

`ls' at 0 [Delaying before reconnect: 8]

Anonymous said...

'ls' at 0 [Delaying before reconnect: 8

Post a Comment