UFW rejecting FTP connections to ProFTPd

Posted July 12, 2014 21.3k views


To strenghten security I want to enable UFW (on Ubuntu 14.04 x64 droplet). I have changed my FTP port from 21 to xx (something else). I allowed this port in ufw by commands:
“sudo ufw allow xx/tcp”
“sudo ufw allow xx”

But unfortunately nothing works for FTP connections. Is it so that I have to enable port 21 as well as xx OR should I try enabling PassiveMode in ProFTPd conf file?

Can anyone throw some light on this issue?


These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
3 answers

I recommend using SFTP instead of FTP as it is more secure. It uses your existing SSH credentials and encrypts the connection unlike FTP.

If you still wish to use FTP, you will need to whitelist port 20 as well and configure your FTP client to use Active mode:

sudo ufw allow 20/tcp
by Pablo Carranza
This article will teach you how to use Filezilla to transfer and manage files securely on your VPS.


For file transfers from my PC, I’m using WinSCP Client. However, I have several sites where users upload their files and I have configured FTP in my site coding so that such uploads can take place over FTP and not through browser. Is this also insecure? If yes, can I configure ProFTPd for SFTP connections? Will those uploads be done through SFTP if configured in coding?

Got the same problem and I use ProFTPD and WinSCP too.
Just allow port range 50000-65535 in ufw, because ftp server choose random passive ports from this range.
Or change passive mode to active.