How to install an FTP server on an Ubuntu based Amazon EC2 instance
I recently run into a strange situation being unable to get an FTP daemon to run on an Amazon EC2 instance with Ubuntu 14.04. If you search around the web the most tutorials will suggest you to install vsftpd. Unfortunately, vsftpd does not complete the installation successfully on Ubuntu 14.04. Another good choice is ProFTPd. I installed that, but this one wouldn't run either at first. It required a very simple workaround, so simple that I thought it is worth writting an article about it, because it is very rarely found over the web.
Prepare the ground
Open ports 20-21 for the main FTP listening socket and a few more (1024-1048 or anything else from 1024 or higher) for passive connections. To do this go to the AWS console page (http://console.aws.amazon.com), open the EC2 service and choose "Security Groups" from the left panel. Click your active security group and then open the "Inbound" tab. Click "Edit" and add two rules of type "Custom TCP Rule". For the first one type "20-21" in the Port Range and "1024-1048" for the second. Click "Save" to save the new rules. Your EC2 instance is now allowed to listen for incoming connections at those two port ranges.
On the next steps you will need to know the the Public DNS and the Elastic IP of your instance. If you don't know them use the AWS console while you are still at it. Choose "Instances" from the left panel, then click on your EC2 instance. The tab "Description" will show you your Public DNS and Elastic IP.
Access your EC2 instance from a terminal and install ProFTPd.
sudo apt-get install proftpd
Edit the ProFTPd configuration file
sudo vim /etc/proftpd/proftpd.conf
Edit "ServerName" and write your Public DNS. Example:
Uncomment "PassivePorts" and write the ports you previously set from the console:
PassivePorts 1024 1048
Uncomment "MasqueradeAddress" and write the Elastic IP of your instance. Example:
Move down the file and comment out the settings for "User" and "Group".
That last part of the installation steps was the way to get around the problem that wouldn't let ProFTPd run smoothly on Ubuntu 14.04. You may want to try with those settings enabled and see if it runs successfully for you. In my attempt, the logs showed that ProFTPd tries to change the active user to the one who logs in, but it does not succeed.
Restart the daemon
sudo service proftpd restart
Access the FTP service
You should now be able to access your FTP server using your Public DNS (ftp://ec2-1-2-3-4.compute.amazonaws.com) or your Elastic IP (ftp://22.214.171.124) as your FTP's host. Use a username and password that exist in your system or make use of the advanced features that allow ProFTPd to give access outside the existing users in your system.