LFTP stuck making Data Connection

LFTP is a nice file transfer program and despite the name, it also supports HTTP, FISH, SFTP, HTTPS, and 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.

Tags:


Forum Replies

  1. Awesome… thanks… been driving nuts for a while now.

  2. This was incredibly useful - thank you! I’ve had this issue numerous times before and usually just used ncftp instead but I couldn’t do that today, so THANK YOU for solving this long-standing issue of mine! :slight_smile:

  3. You are welcome, I also took the easy way out normally but this time I needed LFTP for some backup script so it had to be fixed.

  4. Thanks! You nailed it. All the LFTP scripting I had done in the past used SFTP servers so I was stumped when I got to this latest standard FTP server that didn’t allow SSL.

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