TECHIES WORLD

For Techs.... Techniques.... Technologies....

Linux

How to configure vsftpd in EC2

Vsftpd, is an FTP server for Unix-like systems, including Linux. It is licensed under the GNU General Public License. It supports IPv6, TLS and FTPS. It is the default FTP server in the Ubuntu, CentOS, Fedora, NimbleX, Slackware and RHEL Linux distributions.

This article explains the detailed steps to install and configure vsftpd in AWS EC2 instance.

Step1: Login to your AWS EC2 instance via ssh

Step2: Switch to root user

sudo su -

Step3: Install vsftpd

yum install vsftpd

Step4: Modify the following line in configuration file '/etc/vsftpd/vsftpd.conf' to disable anonymous FTP.

anonymous_enable=NO

Step5: Add the following lines to configuration file '/etc/vsftpd/vsftpd.conf' inorder to enable passive mod.

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

Here we have to replace the public ipaddress of the EC2 instance.

Step6: Modify the following line in configuration file '/etc/vsftpd/vsftpd.conf' to restrict the users to their home directories.

chroot_local_user=YES

Step7: restart vsftpd service

/etc/init.d/vsftpd restart

Step8: Create a user for ftp

adduser awsftpuser

Step9: Change the user's home directoy to document root

usermod -d /var/www/html awsftpuser

Step10: Add ftp user to the httpd service group

usermod -a -G awsftpuser

Here we need to update the name of the httpd service group accordingly.

Step11: Open up the FTP ports on your EC2 instance security group

Log in to the AWS EC2 Management Console and select Security Groups from the navigation tree on the left. Select the security group assigned to your EC2 instance. Then select the Inbound tab, then click Edit:. Add two Custom TCP Rules with port ranges 20–21 and 1024–1048. For Source, you can select 'Anywhere'.

That's all...

Leave a Reply