An ftp server is being used by Drupal when installing new modules. For some reason Drupal uses ftp to copy uploaded files to the filesystem, even when the filesystem is on the same system as the web server.
Furthermore some development tools running outside the vm, e.g. NetBeans on the host is using ftp to synchronize files between the vm and the host.
I use vsftpd as ftp-server. The script install-vsftpd.sh installs vsftpd and generates vsftpd.conf.
Configuration of Virtual box and VSFTPD
It is configured in /etc/vsftpd.conf. Compared to default setup, the following parameters are changed:
- local_umask to 022. This ensures that the www-data user is able to read files uploaded by other users.
- write_enable to yes. This enables ftp users (e.g. NetBeans) to upload files.
- listen to yes. This ensures we are running ipv4. Using ipv6 may cause issues on AWS EC2.
Port forwarding for the virtual box is not required since we have given the vm its own ip and the domain name ubuntu.dev.
You can learn more on vsftpd setup in how-to-setup-and-use-ftp-server-in-ubuntu-linux, when reading about “Stand-alone vs Normal FPT mode”, have in mind that this setup uses Stand-alone mode.
Configuration of Amazon EC2 and VSFTPD
To configure vsftp in the EC2 instance to be accessible from the outside world you additionally to
- get a (sub)domain for the EC2 instance. In case you do not have a domain, you may replace the options mentioned below for vsftpd.con with
- create a security group for the EC2 instance with the following inbound rules
- allow tcp port 20-21
- allow tcp ports 1024-1048
- add the following settings to /etc/vsftpd.conf