vsftpd error Listing Directories

onkar picture onkar · Jan 18, 2011 · Viewed 81.4k times · Source

I installed vsftpd on amazon ec2 with fedora instance and it is the latest version but I am getting the error: In CuteFTP:

COMMAND:> PASV 227 Entering Passive Mode (192,168,10,46,14,20)
COMMAND:> LIST
ERROR:> Can’t connect to remote server. Socket error = #10065.
ERROR:> PASV failed, trying PORT.

In Filezilla:

Command: PASV Response: 227 Entering Passive Mode (192,168,10,46,14,20)
Command: LIST Error: Connection timed out
Error: Failed to retrieve directory listing.

Trying to Connect thro' Shell and showing me list of directories.

Answer

longda picture longda · Aug 7, 2012

Just had this same exact issue... this typically only affects GUI ftp clients that use a passive mode (which is pretty common). For instance, when using the standard ftp command line tool, I was able to successfully login and upload files to my ftp server.

The steps to correct are:

  1. Add the following settings to your /etc/vsftpd.conf file:

    pasv_enable=YES pasv_min_port=64000 pasv_max_port=64321 port_enable=YES

  2. Also add one of the following config chunks to your /etc/vsftpd.conf file, based on your situation (either way, this needs to resolve to a public accessible IP):

a:

pasv_address=<your-static-ip-most-likely-from-elastic-ips>
pasv_addr_resolve=NO

-OR-

b:

pasv_address=<your-publicly-resolvable-host-name>
pasv_addr_resolve=YES
  1. In your security group configuration for ec2 instances, add the following custom inbound tcp rules:
  • Enable ports 20-21 for standard ftp
  • Enable your passive ports as defined in the config sections above (I used 64000-64321)
  1. Restart your vsftpd service (varies depending on your flavor of linux)

Note: pasv port range should be visible outside from the firewall, NAT

References for more info: