Tuesday, September 14, 2010

Pure-FTP Hangs on Login

 
Pure-FTP just now was hanging for me upon
login. I found the following web page:

lftp and pureftp stops
at making data connection


The following suggestion is the one that
did the trick for me:

set ftp:ssl-allow off

I added this to the rightmost part
of the command line:

-e "set ftp:ssl-allow off"

It worked.

Update: March 15, 2014

For whatever reason, I'm having the exact same problem—Pure-FTPd hangs on login. However, this time turning off SSL is not working.

Here's what is working:

-e "set ftp:passive-mode off"

See comment below from Francesco for an alternative way to do the same thing.

Also note that the above link suggests the opposite. The above link suggests that you turn passive mode on rather than off.

This would seem to suggest at least 3 possible reasons why lftp might hang on login with Pure-FTPd:

  1. SSL is on and needs to be turned off
  2. Passive mode is on and needs to be turned off
  3. Passive mode is off and needs to be turned on

Note that all 3 scenarios above are probably distinct FTP servers, each at a different hosting company.

I'm sure someone has a better explanation than I do as to why this is so. For now, I'm just going to assume that each case above is an FTP server that is cnfigured a little bit differently.

Ed Abbott

Friday, April 2, 2010

ProFTPD Makes lftp Hang

 
Just now did an FTP login
into a ProFTPD 1.3.2 Server.
For some reason it hangs.

The following seems to stop
it from hanging:

lftp -u myname,mypassword abc.com 
     -e "set ftp:ssl-allow no"

Not sure why this is. I copied
and pasted from another FTP login
script I have with a different user
but the same hosting company. I've
had the same problem twice with the
same hosting company.

Ah, yes. This has come up before.
Not just twice at the same hosting
company but at a different hosting
company as well.

That's 3 times that I've had same problem
when using lftp and ProFTPD together.
I've just come to this conclusion after
looking at the record and doing a little
research.

More specifically, the problem is not
really logging in. It's after I login.
It seems that lftp hangs with an
endless delay after you've successfully
logged in and tried to type a command.
Even a simple ls command makes
lftp hang under these conditions.

I wrote to Alexander V. Lukyanov,
the creator of lftp. He was kind
enough to write back the following to me:


On Tue, Aug 05, 2008 at 05:32:29AM -0400, Ed Abbott wrote:
> ---> AUTH TLS
> <--- 234 AUTH TLS OK.                                               ... > ---> PASV
> <--- 227 Entering Passive Mode (74,220,219,58,165,243) > ---- Connecting data socket to (74.220.219.58) port 42483
> Interrupt                                

Probably you use a firewall and when control connection is encrypted
it cannot dynamically open ports for data connection. Turn off encryption
with this command:

        set ftp:ssl-allow no

--
   Alexander.


Maybe this will help someone else
who is having the same problem
as I was having. I don't know the
ins and outs of FTP servers so I
don't know why this worked.

There's a principle in all of this
for me and that is share what you
know and you will know more
. It's
a basic teaching principle.

When I make the effort to share what I
know, I learn the most myself. The
teacher learns the most.

Not only did Alexander V. Lukyanov
write free software for others,
he also teaches them (or, at
least me) how to use it. That's
the same principle in operation.
You get the most by giving. It's
a spiritual thing, OK?

I write this in that spirit.
Hopefully, there is someone
out there who needs to know
what I know as badly as I needed
to know it at the time I needed
to know it. When you need to know,
you need to know.

Ed Abbott

Monday, February 1, 2010

lftp Scripts

 
In my last post, I discovered the
following tutorial:

lftp: a better FTP client

In this post, I'd like to explore the
idea of scripting a little bit.

Currently, I'm using lftp in this
form:

$ lftp -u username,password site-url

I'd like to go beyond this. I'd like to
switch to this form:


$ lftp -f lftp-script

I've been inspired by the above tutorial
to try this. It seems to me there are
several advantages to doing so:

  1. I won't have to remember how I
    did it to do it again
  2. I can take commands that I've
    been typing interactively and
    turn them into a script. This
    saves typing.
  3. I can execute precisely the
    same agenda, such a site backup,
    without fail each and every time

So it looks like the next thing I'll
be looking into is writing lftp scripts.

It's funny. I've been using lftp for
years but have not explored this. Or
maybe I did explore it but for some
reason never got it to work.

In any case, I'm finding that it is
possible to use these great utilities
like lftp for years and not
fully explore their potential.

Time to wake up and look around. I've
been in a deep sleep.

Ed Abbott

Wednesday, January 27, 2010

lftp Resources

Here's some lftp resources.

Here is what I suspect is the
lftp main website:

http://lftp.yar.ru/

The reasons I suspect that this
is the lftp main website are as
follows:

  • It seems to be the website
    of the creator and maintainer
    of lftp, Alexander V. Lukyanov.
  • I don't know of any other
    website that has more information
    that is more basic about lftp

Here's an lftp tutorial:

lftp: a better FTP client

Ed Abbott

lftp Loops Endlessly
on Empty Directories

My last post covered this very
same issue:

lftp and Empty Directories

The issue has come up again. This
time, neither the solution I discovered
nor the solution suggested in the
link (in the above post) is working.

Two solutions down the drain. Time
to try again.

OK. Just found a third work around.
Here it is.

Instead of using an lftp command
line option
like the two solutions
above mention, use a mirror command
option instead.

In lftp, mirror is how you recursively
descend into directories to grab all of them.

Here's the mirror command I was using which
was giving me a problem:

mirroc -c

Here's the new mirror command without the prolbem:

mirror -c -x "^etc/$"

Here's the most important
part of the above command:

-x "^etc/$"

The -x option allows me
to exclude directories.

In this case, the directory called
etc is empty. It is causing
lftp to loop endlessly as it
tries again and again to retrieve
directory contents that are not there.

My solution? Use -x to exclude
the directory. The -x option is
mneumonic for exclude

The cool thing about -x is that
it is a regular expression. This
allows me to be very specific.

In this case, I've said that only directories
(notice the trailing slash) that start and
end with etc are to be excluded. In
other words, etc cannot be part of
a larger pattern.

The great thing about regular expressions
is that you can be very very specific.

By the way. This solution has worked perfectly.

This may be the best workaround yet in that it
is often only one empty directory that causes
lftp to hang (loop endlessly).

Ed Abbott