Most people asking how to the 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 the 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 the instance is up and running.
- Install FTP Server(vsftpd)
Connect via SSH to your EC2 instance. and type the following command to install the 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
sudo nano /etc/vsftpd.conf
Disable anonymous ftp access by changing the
Add the following line in vsftpd.conf to allow chroot writable
To restrict the FTP user to their home directory, simply un-comment the following line
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 (Optional)
If you want FTP user to restrict FTP access to a specific folder example /var/www/html then use below command.
sudo usermod -d /var/www/html/ username