Wednesday, 7 November 2012

Linux Tips # SOLVED - Pure FTP Connection Error : Error loading directory

1. How to SOLVED - Pure FTP Connection Error : Error loading directory

enable ftp pots
iptables -A INPUT -s 0/0 -p tcp --dport 20 -j ACCEPT
iptables -A INPUT -s 0/0 -p tcp --dport 21 -j ACCEPT

enable port for passive mode
iptables -A INPUT -s 0/0 -p tcp --dport 30000:50000  -j ACCEPT
save iptables for future

restart iptables
/etc/init.d/iptables restart

whala!   my client says IT WORKS !!

change configuration for passive mode
vi   /etc/pure-ftpd/pure-ftpd.conf
PassivePortRange 30000 50000
Restart  Pure-ftpd
/etc/init.d/pure-ftpd restart

2. Linux Tips # Pure FTP fix for “failed to retrieve directory listing”.

I was setting up pure-ftpd on a system that needed FTP access for users. The users were using FileZilla. For firewall on the server (running RHEL5), I was using iptables. Was having a difficult time getting FTP with TLS to connect and when I was able to get it to connect I would get the error: “failed to retrieve directory listing”.
Error: Connection timed out
Error: Failed to retrieve directory listing
Here is the fix:
# cat /proc/sys/net/ipv4/ip_local_port_range
32768      61000
Make sure ports used do not fall within that range (used by the system). So pick 10000 to 20000, for example.
# iptables -I INPUT 2 -p tcp –dport 10000:20000 -j ACCEPT
# iptables -I OUTPUT 2 -p tcp –sport 10000:20000 -j ACCEPT
Also need port 21 (port 20 was not needed):
# iptables -I INPUT 2 -p tcp –dport 21 -j ACCEPT
# iptables -I OUTPUT 2 -p tcp –sport 21 -j ACCEPT
Save your iptables of course and then restart:
iptables-save > /etc/sysconfig/iptables
service iptables restart
Then in pure-ftpd, go to conf file (/etc/pure-ftpd.conf and set the following line:
PassivePortRange          10000 20000
service pure-ftpd restart

No comments:

Post a Comment