How to enable passive FTP connections in vsftpd

Passive mode can sometimes resolve certain clients ability to connect to the FTP server which may have been blocked by firewalls. If you are having issues connecting remotely,  would like you to try to to enable passive connections in you will need to edit vsftpd.conf.

 

1. Edit the conf file and add the following lines with the letter “i” to insert:

  • pasv_enable=Yes
  • pasv_max_port=10100
  • pasv_min_port=10090

2. You will then also need to add the passive range in the firewall.

 

IPtables:

  • Add the new rule:

iptables -I INPUT -p tcp --destination-port 10090:10100 -j ACCEPT

  • Save the ruleset:

service iptables save

 

Firewalld: 

  • Add the new port range:

 firewall-cmd --permanent --zone=public --add-port=10090-10100/tcp

  • Reload the firewall:

firewall-cmd --reload

 

3. Testing The FTP Service

You can test the FTP configuration locally first to ensure the daemon is running by using netstat

# netstat -plan|grep :21

You can also connect locally by installing the ftp client:

yum install -y ftp

And then making a connection to the localhost or 127.0.0.1

 ftp localhost