UFW rejecting FTP connections to ProFTPd


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” OR “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?

– Regards Saurabh

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

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.


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?

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