LFTP stuck making Data Connection

Today I was trying to make the FTP backup for WordPress work but my CentOS webserver got stuck at ‘making data connection’ when using LFTP for the file transfer. LFTP is a nice file transfer program and despite the name it also supports HTTP, FISH, SFTP, HTTPS, FTPS besides FTP transfers. By default when you try LFTP to connect to a remote server this is what you might encounter:

[root@server backup]# lftp -u username,password myftp.servername
lftp username@myftp.servername:~> ls
`ls' at 0 [Making data connection...]

LFTP supports both FTP with or without SSL enabled. Apparently it tries to connect by default using SSL but my FTP server doesn’t support this.It will hang at ‘making data connection’ and that’s it. There are two ways how you can solve this. First of all you can do it using the command-line:

[root@server backup]# lftp -e "set ftp:ssl-allow off;" -u username,password myftp.servername
lftp username@myftp.servername:~> ls
drwxrwxrwx   1 1026     100              4096 Jan 25 19:06 Folder1
drwxrwxrwx   1 1024     100             12288 Jan 29 03:54 WPBackups
lftp username@myftp.servername:~>

Just add “set ftp:ssl-allow off;” to make LFTP disable SSL. You can also disable it globally by editing the lftp.conf file:

[root@server backup]# vim /etc/lftp.conf

Use any text editor you like and add the following line to this file:

set ftp:ssl-allow false

Save and quit and now you can run the LFTP command without any additional parameters:

[root@server backup]# lftp -u username,password myftp.servername
lftp username@myftp.servername:~> ls
drwxrwxrwx   1 1026     100              4096 Jan 25 19:06 Folder1
drwxrwxrwx   1 1024     100             12288 Jan 29 03:54 WPBackups
lftp username@myftp.servername:~>

That’s all there is to it! Happy FTP’ing! If this lesson has helped you please leave a comment or share it.

Forum Replies

  1. Thanks dude, you saved me the day

  2. I had a bash script tied to scrot to upload screenshots to my website and I had this exact problem a while back. I had thought something was wrong with my host. Thanks for this; my script now works correctly! I wonder what led the lftp guys to setting SSL support on by default. It’s usually a good idea, but how many hosts out there actually support SFTP?

  3. THANK YOU. Saved my pasty white butt on this one.

  4. I was also having this problem and disabling SSL didn’t work. I found the problem was because of CSF (the firewall). I had to disable passive mode, set the port range, and add the port range to csf.conf.

    I added the following to /etc/lftp.conf:

    set ftp:passive-mode off
    set ftp:port-range 64200-64300

    And I added 64200:64300 to the TCP_IN line in /etc/csf/csf.conf. So it should look something like this:

    TCP_IN = “20,21,22,25,53,80,110,143,443,465,587,993,995,3306,64200:64300”

    You will also need restart CSF (using ‘csf -r’)

  5. Good morning!

    Actually lftp issue AUTH TLS when this command is advertised by the FTP server.

    1. AUTH TLS is falsly advertised (very rare)
    2. the FTP server’s encryption setup has an error (I do have a case like this)
      My vps has a working proftpd TLS setup.

9 more replies! Ask a question or join the discussion by visiting our Community Forum