Created: Last updated:
The problem I explain here is usually related to FTP in passive mode and when you use VSFTPD on Linux as your FTP server and FileZilla as the FTP client. Your FTP server in this case is usually also behind a firewall.
If you use a command line ftp client or other GUI FTP clients you may be just fine without seeing any problems. Or maybe see other forms of error messages.
In case you face the problem described here while setting up FTP in the Amazon cloud, I have a document Enable FTP for passive mode that has more detailed information specific to AWS EC2.
When you have a FTP server your FileZilla client may sort of hang like this:
- Status: Retrieving directory listing...
- Command: PWD
- Response: 257 "/"
- Command: TYPE I
- Response: 200 Switching to Binary mode.
- Command: PASV
- Error: Disconnected from server: ECONNABORTED - Connection aborted
- Error: Failed to retrieve directory listing
Note that the line Command: PASV asked for passive mode but it never completes.
That's because FileZilla is verifying something in the background. Unfortunately you cannot see an error even when you turn on debugging. Because this problem is most likely linked to your own FTP server and you use vsftpd as your FTP server you can turn on ftp logging and then you will find a response that looks somehting like this:
- "227 Entering Passive Mode (10,12,35,53,75,191)."
Note the first four numbers in the parenthesis 10,12,35,53. This is the host's local IP address. In this case a private 10.x.x.x range.
If that server is shielded from the Internet with NAT (Network Address Translation) your FileZilla client will receive this number as the IP for passive mode and compare it with its known public address. Because it is not the same address it will terminate, i.e. disconnect from the server. Connection aborted!
Set passive address
The solution is rather simple. You will have to set the public IP address into the VSFTPD configuration. Look in the man pages for pasv_address for more information.
If you don't set the pasv_address which has to be your external IP address vsftpd will submit the local server IP address which is 10.12.35.53 in the example I've shown above.