# vim /etc/vsftpd/vsftpd.conf
anonymous_enable=NO
local_enable=YES
chroot_local_user=YES
### add these lines to the end of vsftpd.conf. This is to configure to use passive mode. Otherwise, you would see "Failed to retrieve directory listing. Connection timeout".
pasv_enable=YES
pasv_min_port=12000
pasv_max_port=12100
pasv_address=<Public IP of your instance>
pasv_addr_resolve=NO
# systemctl enable vsftpd
# systemctl restart vsftpd
# useradd ftp-user1 -m -c 'ftp user' -s /sbin/nologin
# usermod -s /sbin/nologin ftp-user1
# chmod a-w /home/ftp-user1
Note: if you see 500 OOPS: vsftpd: refusing to run with writable root inside chroot (), make sure the user's home directory is not writable.
# passwd ftp-user1
# firewall-cmd --permanent --zone=public --add-port=20-21/tcp
# firewall-cmd --permanent --zone=public --add-port=12000-12100/tcp
# firewall-cmd --reload
# firewall-cmd --zone=public --list-all
Note: make sure you do open these ports on your Amazon EC2 instance security group as well.
# setsebool -P ftp_home_dir 1
# getsebool -a | grep ftp
ftp_home_dir --> on
Reference:
http://stackoverflow.com/questions/4723023/vsftpd-error-listing-directories
http://linuxconfig.org/how-to-setup-vsftpd-ftp-file-server-on-redhat-7-linux
No comments:
Post a Comment