Tuesday, November 9, 2010

Why I did encounter error " ftp: connect: Connection refused" ?

■  Error  : "ftp: connect: Connection refused"
■ OS Environment : Linux[RHEL, Centos]
■ Application: pure-ftpd, iptables
■ Resolution : 

    If you get this type of error message, please check the server's firewall first. I have faced this error message during connecting to the FTP server. In my case, passive ports ranges were not enabled in the FTP and iptables firewall.

PassivePortRange 30000 50000

Add the above line in the ftp configuration file,

Enable them in the iptables like :

iptables -A INPUT -p tcp --destination-port 30000:50000 -j ACCEPT
iptables -A OUTPUT -p tcp --source-port 30000:50000 -j ACCEPT

Execute following commands 

$service iptables save
$ service iptables restart
$ /etc/init.d/pure-ftpd restart

       Another important point is that you may connect to the server through "active mode [server will connect to the client]" through the FTP client(like filezilla). Just enable the option a the FTP client and retry to connect.

No comments:

Post a Comment

Post a Comment