Skip to content

Instantly share code, notes, and snippets.

@manojkumararyan
Last active August 29, 2018 04:41
Show Gist options
  • Select an option

  • Save manojkumararyan/0191f639d7a32be6576f682c8e5208ad to your computer and use it in GitHub Desktop.

Select an option

Save manojkumararyan/0191f639d7a32be6576f682c8e5208ad to your computer and use it in GitHub Desktop.
sudo apt-get update
sudo apt-get install vsftpd
sudo nano /etc/vsftpd.conf #open this file
#uncomment these settings
write_enable=YES #for write access
local_umask=022
chroot_local_user=YES #chroot_local_user is to restrict local user to their home directories. (/home/{user}/)
#Add these lines at bottom of the file
allow_writeable_chroot=YES
pasv_enable=Yes
pasv_min_port=1024
pasv_max_port=1048
port_enable=YES
#If you use AWS EC2, you have a fixed public IP address, then add these lines
pasv_addr_resolve=NO
pasv_address=<SERVER_IP_ADDRESS>
#If you do not have a fixed IP address, then add these lines
pasv_addr_resolve=YES
pasv_address=<SERVER_FQDN OR SERVER_PUBLIC_IP_ADDRESS>
#Create FTP User and allow login access to nologin shell. (By defaylt, you can use port 21)
sudo useradd -m robin -s /usr/sbin/nologin
sudo passwd robin
sudo nano /etc/shells #open this file
Add "/usr/sbin/nologin" to /etc/shells
#restart vsftpd
sudo service vsftpd restart
#open ports in aws ec2 security groups
TCP 20 to 21
TCP 1024 to 1048 #if enable passive mode
#again restart vsftpd
sudo service vsftpd restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment