I installed pureftpd on a VPS (ovh).
I can list a small directory (by small I mean a directory with just some files) but if I try to list a big one containing maybe thousands of files, including directories I have a "Failed to retrieve directory listing" error message from filezilla client when I click on the "ps" directory :
Command: USER xxxxx
Response: 331 User xxxxx OK. Password required
Command: PASS ************
Response: 230 OK. Current directory is /
Command: OPTS UTF8 ON
Response: 200 OK, UTF-8 enabled
Status: Connected
Status: Retrieving directory listing...
Command: CWD /ps
Response: 250 OK. Current directory is /ps
Command: TYPE I
Response: 200 TYPE is now 8-bit binary
Command: PASV
Response: 227 Entering Passive Mode (,156,188)
Command: MLSD
Response: 150 Accepted data connection
Response: 226-Options: -a -l
Response: 226 33 matches total
Error: Connection timed out
Error: Failed to retrieve directory listing
From the command line I just have a never ending wait :
ftp> cd ps
250 OK. Current directory is /ps
ftp> ls
200 PORT command successful
150 Connecting to port 38359
I added this rules to iptables since I read it could fix the problem on my server :
root@vpsxxx:/var/www/html# iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT tcp -- anywhere anywhere tcp dpt:ftp-data ctstate RELATED,ESTABLISHED /* Allow ftp connections on port 20 */
ACCEPT tcp -- anywhere anywhere tcp spts:1024:65535 dpts:1024:65535 ctstate ESTABLISHED /* Allow passive inbound connections */
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
ACCEPT tcp -- anywhere anywhere tcp dpt:ftp-data ctstate ESTABLISHED /* Allow ftp connections on port 20 */
ACCEPT tcp -- anywhere anywhere tcp spts:1024:65535 dpts:1024:65535 ctstate RELATED,ESTABLISHED /* Allow passive inbound connections */
I Added a fix port range for passive mode in pureftpd :
root@xxx:/var/www/html# cat /etc/pure-ftpd/conf/PassivePortRange
40110 40210
root@xxx:/var/www/html#
These are the permissions on my ps directory I'm trying to list :
drwxr-xr-x 25 root root 4096 May 9 08:29 ps
This is the iptables on my client os (Debian 8) :
-P INPUT ACCEPT
-P FORWARD ACCEPT
-P OUTPUT ACCEPT
It looks like everything I tried is useless and has no effect.
I tried to analyse the traffic with wireshark and it looks like I get part of my directory listing in a FTP-DATA protocol packet but then something is going wrong but I don't know what...
Just noticed I had the same problem with proftpd, I thought it would work better with pureftpd, but no :)
Asked by Laurent
(121 rep)
May 9, 2017, 08:01 AM
Last activity: Dec 15, 2018, 03:11 PM
Last activity: Dec 15, 2018, 03:11 PM