How To Setup FTP On AWS EC2 Instance

Most people asking how to setup of FTP on Amazon web service on EC2 instance for their website to upload and download files or data. In today’s world FTP is best way to transfer data between client and server. Hare i am going to explain how to configure FTP server on Amazon Web Service EC2 instance. I’m assuming that you already have an EC2 Ubuntu instance created and instance is up and running.

Install FTP Server(vsftpd)

Connect via SSH to your EC2 instance. and type the following command to install ftp server.

sudo apt-get install vsftpd

Open Port on security group of your instance.

Log in to the AWS EC2 Management Console and select Security Groups from the navigation. Select the security group assigned to your EC2 instance and select inbound tab and edit.

And click on Inbound and than edit

and add Custom TCP Rule 20-21 and Custom TCP Rule 1024-1048.

Update the vsftpd.conf file

Edit the vsftpd.conf file by typing

sudo nano /etc/vsftpd.conf

Disable anonymous ftp access by changing the anonymous_enable=YES to anonymous_enable=no

Add the following line in vsftpd.conf to allow chroot writable

allow_writeable_chroot=YES

To restrict the ftp user to their home directory, simply un-comment the following line

chroot_local_user=YES

Add the following lines to the bottom of the vsftpd.conf file

pasv_enable=YES
pasv_min_port=1024
pasv_max_port=1048
pasv_address=<Public IP of your instance>

* Replace pasv_address to your EC2 instance public ip

Restart FTP Server

sudo service vsftpd restart

Create ftp User

sudo adduser ftpuser
sudo passwd ftpuser

Change user's home directory (Optionals)

If you want ftp user to restrict FTP access to a specific folder example /var/www/html than use below command.

sudo usermod -d /var/www/html/ username

That's It

Comments are closed