I’ve practically spent the whole day trying to resolve the issue of not being able to access to my FTP server with Filezilla. Each time I tried to login, Filezilla hangs at the command that says MLSD and unable to proceed further. Actually, I’ve already login but just that the server refused to list the remote directory.

Contacted support at the hosting company and they tried every ways they could to get it resolved but to no avail. All we knew was that it could be due to some firewall issues in the server.

Previously it was working perfectly until my VPS was migrated to a new server and that was when the FTP issue cropped up. Finally, I’ve got no choice left but to access the server via SSH myself to check on the configuration files. What I’ve found out was that the PassivePortRange has been commented out from the file pure-ftpd.conf. So I just removed that comment and the FTP starts to flow again perfectly.

In case if you’re faced with  similar problems of not being able to access your server as it hangs at the MLSD stage, this is what I’ve done:

  1. Login to the server using SSH as root user
  2. Open the file /etc/pure-ftpd.conf
  3. Scroll down and look for the line that says “PassivePortRange 30000 35000”
  4. Make sure it is not commented out (with a # at the front)
  5. Save the file
  6. Restart the FTP server

And it should work now!

usin/etc/pure-ftpd.conf

Tags: , , , , , , , ,

32 Comments on FTP Server hangs at MLSD command when accessing with Filezilla

  1. Zack Goutham says:

    Hi,

    If you are not behind a router and are directly connected to the internet, you should try uninstalling firewalls installed on your computer. I had two extra firewalls installed on my PC when I started having the same problem. I guess it’s PC tools which blocked file transfer. PC tools’ free firewall seems to have a basic filtering rule for all applications. Using a smart firewall would solve the problem if you are having the same problem.

  2. Bill says:

    Yea I am having the smae issues with MLSD. I can get into the FTP using a VPN but it may still hang and I ahve to refresh it over and over. I am wondering if this some router issue but my router page is all in Chinese (I live in China) and so I am lost, all I can do is reboot.

    I am assuming you mean to get into your server via some like Cpanel?

    I can get into my FTP for now and I will look for that file in /etc/ and see what it looks like.

  3. monee says:

    When using Verizon MIFI, I have this problem with only one of my accounts – the rest of my accounts all work just fine so I am thinking it is a server setting for that one account. It will not let DW connect either BUT everything works fine when I reconnect with my original ISP instead of MIFI. Oh, and I can connect with CPanel.

  4. Trev says:

    Quick addon to the fix.

    Just battled with this and the above was part of the fix, but if it doesn’t work you might need to open a hole in your firewall to allow the extra ports to work.

    If you’ve got the APF firewall installed then do the following to open up the ports and it should hopefully start working:

    — Do pico -w /etc/apf/conf.apf
    (The -w turns off word wrapping which is important)

    — Find the line starting IG_TCP_CPORTS=

    — At the end of this line we need to add the port numbers from the PassivePortRange so that we open up the firewall, eg:

    IG_TCP_CPORTS=”21,30,55,30000_50000″

    — Finally restart the APF firewall with:
    /etc/init.d/apf restart

    Hopefully that’ll help someone else who ran into the same problems as me.

  5. Alvin Cheong says:

    Trev,
    Thanks for the quick addon to the fix.

    Rgds,
    Alvin.

  6. Peter says:

    Thanks, fast fix!

  7. raymond says:

    Set FileZilla Client Transfer Settings to Active. Should be under site manager. No need make changes to firewalls. They are there for a reason.

  8. Dan says:

    Hi there,

    I just changed the FileZilla TRANSFER MODE to ACTIVE and not PASSIVE(RECOMMENDED) and it solved the issue without having to make changes at the server side.

    In lot’s of cases configuring the FTP server isn’t an option (for example on a locked down NAS or people using shared hosting).

    Just try the above, worked for me 🙂

  9. ibeleave says:

    Thank you raymond! just saved me some hair pulling! My FileZilla settings were for “auto” – changed to “active” and good to go. I too just changed from vps to smartvps – old settings worked on the earlier server, not on the new one.

  10. Hasith says:

    I tried both modes and none works for me.

    Still get stuck at MLSD.

    Using FileZilla 3.5.3

  11. William says:

    Thanks Raymond,

    indeed changing the FileZilla transfer mode to active solved similar issue for me. Brilliant!

    William

  12. sardelich says:

    Excellent with active mode 🙂 I just changed port of FTP to new one because of frequent attacks and since I couldnt manage to get CSF port range working,switched filezilla to active and voila 🙂

  13. Abir says:

    Thanks raymond, also worked for me !

  14. Raymond Garay says:

    Yes it works for me as well by changing the Transfer Mode to Active under Transfer Settings tab.

  15. Matthew Vader says:

    “Open the file /etc/pure-ftpd.conf”

    That file doesnt exist on my server… I used apt-get install ftp

    disabling ufw on the server and computer no luck

    changing filezilla to active also no.

    Im kinda stumped ive apt-get remove ftp.* and re installed ftp as well…

    still hanging on MLSD.

  16. Anupam says:

    wow nice, it worked lol! I was getting frustrated haha..

  17. Marc MAURICE says:

    For information, we also had the MLSD command problem, but this was not a firewall issue, but too many files in the directory (more than 40 000).

  18. Hello,
    I had this problem while connecting with my Internet key and in Internet cafés.

    I solved it by using WinSCP: if your hosting provider is HostGator as I do, you can easily set up SSH for using it instead of FTP (and it’s safer!)

  19. Maureen says:

    Thanks a lot,

    this worked like magic

  20. Virendra says:

    Thanks Raymond

    You saved my time on trying different methods. It worked.

  21. Paul Buchanan says:

    I just wanted to take a second to thank Raymond – you just saved me hours!!!! I only wish I had thought to find this hours ago!!!

  22. Shweta says:

    Thanks Raymond. You saved me! 🙂

  23. Michael says:

    I had this problem on a cPanel server – it would get stuck at MLSD when using FileZilla. I resolved it by restarting CSF+LFD from the WHM interface. Using the fix mentioned in this post (I tried that first) didn’t help. I changed it back to original, and it still works fine so I can only assume it was a firewall problem not a configuration problem. Still, thanks for posting this because it got me thinking.

  24. Alvin Cheong says:

    Michael, thanks for sharing.

  25. Stuart says:

    I fixed this issue with my Hostgator VPS server. If you log into WHM, under service configuration, click on ftp server seletion. In the window that opens choose ProFTPD. I couldn’t access the files stated by the author of this post, but changing to ProFTPD got rid of the really annoying problem. The problem only happened for me when I was using a certain internet connection, with all others connections ftp was working fine. Odd!

  26. Sandi says:

    Thanks for this! On a Windows 2012 machine, I had to go into the Windows Firewall settings and make sure my FTP incoming connection rule opened ports 21,30000-35000. After that the MLSD command started working. Kudos!

  27. dastiw1 says:

    Raymond, Thank you!
    You are my angel =)

  28. Mike Swanberg says:

    Had this issue on my Synology NAS; tried opening the ports but my router complained about the number of ports I was opening. So I fiddled about in my Synology settings and found that when I turned on “Report external IP in PASV mode” under Control Panel/File Services/FTP, suddenly the problem went away.

  29. Suzanne says:

    Hello, I tried following your instructions, but my /etc directory was empty – no pure-ftpd.conf file at all.

    FYI – I never had Avast installed in the first place (interference from Avast/AVG being a common theme running through several forums on this topic). I completely uninstalled my expired McAfee, which continued to disable all access to Windows Defender even in its uninstalled state (until I ripped it out of the Registry, too). Now that I have access to Windows Defender and have disabled its firewall, FTP still hangs at MLSD for some hosting services.

    FYI – I am running two Win 8.1 computers, a Win Vista, & a Linux Mint all through the same router. The Win 8.1 computers, once they were upgraded from 8.0, can no longer use FTP on some hosting services, but I’ve found can use it on others. FTP from the Vista and the Linux Mint always work fine for all hosting services I use.

    Because the problem is only on some hosting services (but they are the big ones for me), that is probably why the problem in 8.1 is so hard to trace down.

  30. Chamyra says:

    There are some Pure-ftpd installations without a pure-ftpd.conf file. Instead you’ll find various conf files at /etc/pure-ftpd/conf/
    The one you’ll need is PassivePortRange. If it’s nonexistant just add it. It should contain just one row with the port range like from_port to_port. For example 30000 50000

  31. Kristof says:

    Changing filezilla settings to active helped, thanks!

  32. web hoster says:

    Can you let me know what to add to the firewall CSF for this to work?

    I think I need to open some ports but not sure what option to use to add the new ports.

    TCP_IN =

    TCP_OUT =

    UDP_IN =

    UDP_OUT =

Leave a Reply