Failure retrieving contents of directory
The FTP protocol requires one of the two computers involved in the transfer to open a data connection on a second port in order to complete the transfer. In 'Active' mode, the client opens a port and the server connects back to the client. In 'Passive' mode, the server opens a port and the client connects to the server a second time.
Problems with this are usually caused by port-blocking firewalls.
In the old days - FTP was invented in the 1980s - port-blocking firewalls were uncommon. In the 90's and 00's, however, it became common for home, business and other end-users to be behind a port-blocking firewall such as a home router, and Active mode would often fail.
These days, however, it is very common for the server itself to be behind a port-blocking firewall for security reasons. Home and business users now have the ability to dynamically open ports using features such as UPNP. So the situation is reversed: Active mode will often work, and Passive mode will often fail.
If both the server and client are behind a firewall, and no feature such as UPNP is available, you will not be able to transfer anything with FTP. If only the control port (usually port 21) is open, you will be able to see directory listings, but not transfer any files.
If available, SSH or SCP are much more reliable protocols that are far more compatible with modern firewalling.
Related videos on Youtube
![Admin](/assets/logo_square_200-5d0d61d6853298bd2a4fe063103715b4daf2819fc21225efa21dfb93e61952ea.png)
Admin
Updated on September 18, 2022Comments
-
Admin almost 2 years
Currently I have a couple of websites. My problem is that if I login on 1 specific domain with any of my programs (using notepadd++, FileZilla and Netbeans) the program stops at the content listing.
I had it correctly running, (I'm working on a project on this domain for more than a year now) and suddenly I broke it somehow.
This only happens on 1 specific domain, all other domains (from other hosts) are working. My colleague (next to me with same ip address) is able to login on this domain.
- Notepadd++ says: Failure retrieving contents of directory
- Filezilla says: Failed to retrieve directory listing
- Netbean popups: Upload files on save failed. (Because I have the setting upload on save enabled.)
What I tried:
- First I thought it's my firewall, I disabled firewall but no result. Also notice that all other domain are working.
- Maby a blacklist with my ip address? No my colleague has the same ip address.
Could anyone help me on this?
Notepad++ Log
[NppFTP] Everything initialized -> TYPE I Connecting -> Quit 220 ProFTPD 1.3.3e Server ready. -> USER username 331 Password required for domain -> PASS *HIDDEN* 230 User username logged in -> TYPE A 200 Type set to A -> MODE S 200 Mode set to S -> STRU F 200 Structure set to F -> CWD /domains/domain.nl/ 250 CWD command successful Connected -> CWD /domains/domain.nl/ 250 CWD command successful -> PASV 227 Entering Passive Mode (194,247,31,xx,137,xx). -> LIST -al Failure retrieving contents of directory /domains/domain.nl/
Filezilla log
Status: Verbinden met 194.247.xx.xx:21... Status: Verbinding aangemaakt, welkomstbericht afwachten... Antwoord: 220 ProFTPD 1.3.3e Server ready. Commando: USER username Antwoord: 331 Password required for username Commando: PASS ******** Antwoord: 230 User username logged in Commando: SYST Antwoord: 215 UNIX Type: L8 Commando: FEAT Antwoord: 211-Features: Antwoord: MDTM Antwoord: MFMT Antwoord: LANG en-US;ja-JP;zh-TW;it-IT;fr-FR;zh-CN;ru-RU;bg-BG;ko-KR Antwoord: TVFS Antwoord: UTF8 Antwoord: AUTH TLS Antwoord: MFF modify;UNIX.group;UNIX.mode; Antwoord: MLST modify*;perm*;size*;type*;unique*;UNIX.group*;UNIX.mode*;UNIX.owner*; Antwoord: PBSZ Antwoord: PROT Antwoord: REST STREAM Antwoord: SIZE Antwoord: 211 End Commando: OPTS UTF8 ON Antwoord: 200 UTF8 set to on Status: Verbonden Status: Mappenlijst ophalen... Commando: PWD Antwoord: 257 "/" is the current directory Commando: TYPE I Antwoord: 200 Type set to I Commando: PASV Antwoord: 227 Entering Passive Mode (194,247,31,xx,xxx,xx). Commando: MLSD Fout: Verbinding verloren Fout: Ontvangen van mappenlijst is mislukt
Sorry that it's dutch.
Next edit
I changed the transfer connection mode from passive to active and got it working. Does anyone know why my computer wants it to be active if I used passive for more then a year?
So weird that only my computer needs this setting after this while of use the other setting...
-
Admin almost 12 yearsHave you more error from the host, in log file?
-
Admin almost 12 yearsI cannot login (tried the direct admin)
-
Admin almost 12 yearsEven in SSH or you didn't have a ssh acces?
-
Admin almost 12 yearsYou can't login using the same username/password on another machine? The "Failure retrieving contents of directory" is simply the consequence of not being able to login?!
-
Admin almost 12 years@w3d I can login. See edit*
-
Admin almost 12 yearsAre you logging in as the same user as your colleague?
-
Admin almost 12 years@w3d Yes I use the same login info. This was working for more than a year and suddenly I didnt get the file listing. I never changed the login info.
-
Admin almost 12 years"Verbinding verloren" (connection lost)?
-
Admin almost 12 yearsYes :)
Verbinding verloren = connection lost
Ontvangen van mappenlijst is mislukt = Failure retrieving file list
-
Admin almost 12 yearsI see you've got it working by changing from passive to active connection. Ordinarily I would have said this was a local firewall issue apart from the fact that active connections are usually more problematic with local firewalls because they require an inbound connection?! Puzzling.
-
Admin almost 12 yearsWell, I deleted my virus scan (AVG) and disable firewall in windows. Still not working on passive.