Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I am running proFTPd on my CentOS linux VM (which is behind NAT).

This is my proftpd.conf configuration so far: http://pastebin.com/raw.php?i=X8rXYbSJ

When ever I connect to the ftp account in FileZilla client, I am getting the following:

Status: Connecting to 109.xxx.xx.xxx:2121...
Status: Connection established, waiting for welcome message...
Response:   220 FTP Server Ready.
Command:    USER exampleuser
Response:   331 Password required for exampleuser
Command:    PASS ******
Response:   230 User exampleuser logged in
Command:    SYST
Response:   215 UNIX Type: L8
Command:    FEAT
Response:   211-Features:
Response:    MDTM
Response:    MFMT
Response:    LANG ja-JP;ko-KR;bg-BG;zh-TW;en-US;ru-RU;it-IT;fr-FR;zh-CN
Response:    TVFS
Response:    UTF8
Response:    MFF modify;UNIX.group;UNIX.mode;
Response:    MLST modify*;perm*;size*;type*;unique*;UNIX.group*;UNIX.mode*;UNIX.owner*;
Response:    REST STREAM
Response:    SIZE
Response:   211 End
Command:    OPTS UTF8 ON
Response:   200 UTF8 set to on
Status: Connected
Status: Retrieving directory listing...
Command:    PWD
Response:   257 "/" is the current directory
Command:    TYPE I
Response:   200 Type set to I
Command:    PASV
Response:   227 Entering Passive Mode (109,xxx,xx,xxx,237,74).
Command:    MLSD
Error:  Connection timed out
Error:  Failed to retrieve directory listing

I've looked in /var/log/proftpd/ folder and it's empty.

I found the following in this file /var/log/messages:

Oct 29 12:34:33 mageDev proftpd[27542]: 127.0.0.1 - ProFTPD killed (signal 15)
Oct 29 12:34:33 mageDev proftpd[27542]: 127.0.0.1 - ProFTPD 1.3.3g standalone mode SHUTDOWN
Oct 29 12:34:34 mageDev proftpd[27560]: 127.0.0.1 - ProFTPD 1.3.3g (maint) (built Sat Sep 14 2013 20:13:10 UTC) standalone mode STARTUP
Oct 29 12:34:53 mageDev proftpd[27562]: 127.0.0.1 (::ffff:46.xx.xxx.xx[::ffff:46.xx.xxx.xx]) - FTP session opened.
Oct 29 12:34:53 mageDev proftpd[27562]: 127.0.0.1 (::ffff:46.xx.xxx.xx[::ffff:46.xx.xxx.xx]) - Preparing to chroot to directory '/ftp/exampleuser'

How can I diagnose this error/problem? Why is it throwing the error Failed to retrieve directory listing?

This is the server folder for this exampleuser:

enter image description here

I realise a similar question like this already asked here: proftpd, dynamic IP, and filezilla: port troubles

Unlike this user, if I remove my MasqueradeAddress I get this warning and still same error:

Status: Server sent passive reply with unroutable address. Using server address instead.
Command:    LIST
Error:  Connection timed out
Error:  Failed to retrieve directory listing
share|improve this question
    
On the firewall, we allow all outgoing connection. port 2121 is open for the incoming connection. –  Latheesan Nov 1 '13 at 10:19

2 Answers 2

You get the "Failed to retrieve directory listing" error message because the FTP client does not get the directory listing from the server, most likely due to a firewall or network issue.

The FTP protocol was invented long before network firewalls and Network Address Translation, and it uses a separate command channel and data channel for the communication.

When you log in, only the command channel is in use.

When you perform a directory listing, the client and server tell each other on the command channel on what IP address and port (60746 in your example) the data channel should be dynamically set up on for the transfer of the directory listing data.

This is done with the FTP command PORT or PASV.

In your case, the client issue the PASV command, and the server replies with: 227 Entering Passive Mode (109,xxx,xx,xxx,237,74).

The first 4 octets within the parenthesis make the IP address, and the last two the port number (256*237 + 74 = 60746).

Are you running the FTP server inside a virtual machine with a NAT-style network adapter configured for the virtual machine (as opposed to Bridged)? Then this is most likely the cause of your problems, because those kinds of VM:s are usually not reachable from "the outside", since they share the physical host's IP address.

Are ports 60000-65535 open on the server? Your config specifies that range to be used for passive connections. You can narrow it down to a shorter range to require fewer open ports in the firewall.

share|improve this answer

1) Make sure that your VM runs in Bridged networking mode so you get an IP from your router's NAT, and you are not NAT'ed twice.

2) You have to enable the MasqueradeAddress option in ProFTPd config and enter your public IP there (try whatismyip.com)

3) You have to uncomment the Passive Ports option in ProFTPd config. It has two numbers there, they are supposed to form a range FROM - TO. You can make the range a lot smaller if you want.

3) You have to forward the following ports from your router to the corresponding FTP VM ports: 20, 21 and whole Passive Ports range.

share|improve this answer
    
1) the VM is served from Hyper-V and the networking is Bridged. 2) Yes i've used the public WAN IP for MasqueradeAddress and it didn't work. 3) Check my config, i am defining/using passive port range 60000 65535 4) I am only using port 2121 (non standard) and it's already opened (else I wouldn't be able to connect). Aren't the passive ports are outgoing connection? Our firewall is set to allow ALL outgoing connection. Do i need to open the passive range for inbound also? –  Latheesan Nov 1 '13 at 14:08
    
Port 20 is only needed for active FTP, and the OP uses 2121 instead of 21. –  MattBianco Nov 1 '13 at 14:25

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.