Enable passive mode FTP

Thu 11 December 2014
By alex

I've found that getting passive FTP transfers to work has often been the most frustrating part of setting up a server. Because of that, here are instructions for configuring passive mode for the most popular FTP servers.

proFTPD

vi /etc/proftpd.conf
PassivePorts 30000 50000

vsftpd

vi /etc/vsftpd/vsftpd.conf
pasv_enable=YES
pasv_min_port=30000
pasv_max_port=50000

Pure-FTPd

vi /etc/pure-ftpd/pure-ftpd.conf
PassivePortRange          30000 50000

And here are the accompanying iptables rules:

-A INPUT -p tcp -m tcp --dport 20:21 -m state --state NEW,RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p tcp -m tcp --dport 30000:50000 -m state --state NEW,RELATED,ESTABLISHED -j ACCEPT