Install VSFTPd on AWS EC2



sudo apt install vsftpd
sudo cp /etc/vsftpd.conf /etc/vsftpd.conf.original
sudo nano /etc/vsftpd.conf

anonymous_enable=NO
chroot_local_user=YES
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd.chroot_list
ls_recurse_enable=YES
local_root=/var/www
seccomp_sandbox=no
pam_service_name=ftp
pasv_enable=YES
pasv_min_port=13000
pasv_max_port=13100
port_enable=YES
pasv_address=__your_ec2_domain__
pasv_addr_resolve=YES

sudo useradd myftp
sudo passwd myftp
sudo usermod --home /var/www/ myftp

sudo addgroup ftpusers
sudo usermod -a -G ftpusers myftp
sudo usermod -a -G www-data myftp
sudo usermod -g ftpusers myftp

sudo nano /etc/vsftpd.chroot_list
ubuntu

sudo nano /etc/ssh/sshd_config

Match Group ftpusers
ForceCommand internal-sftp
ChrootDirectory /var/www/
PermitTunnel no
AllowAgentForwarding no
AllowTcpForwarding no
X11Forwarding no

sudo service ssh restart
sudo systemctl restart vsftpd

Set you EC2 Security Group to allow incoming tcp traffic to port 20-21, 13000-13100
Connect from you ftp client and set connection to passive mode

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s