##############################################################################
1. Close the Firewall service
=====the COMMAND you CAN TYPE into YOUR console======
#systemctl Stop Firewalld.service//stop the Firewall service
#systemctl Disable Firewalld.service//disable it to luanch when the system starts up
##############################################################################
2. Install Iptables
=====the COMMAND you CAN TYPE into YOUR console======
#yum install iptables iptables-services//install iptables
#vim/etc/sysconfig/iptables//edit iptables ' configuration file
# Firewall configuration written by system-config-firewall# Manual customization of this file is not recommended.*filter:i Nput Accept [0:0]:forward Accept [0:0]:output Accept [0:0]-a input-m State--state established,related-j accept-a INPUT -P icmp-j accept-a input-i lo-j accept-a input-m State--state new-m tcp-p TCP--dport 22-j ACCEPT-A input-m s tate --state NEW -m tcp -p tcp --dport 21 -j ACCEPT-A INPUT -m state --state NEW -m tcp -p tcp --dport 10060:10090 -j ACCE PT-A input-j REJECT--reject-with icmp-host-prohibited-a forward-j REJECT--reject-with Icmp-host-prohibitedcommit
Type <-: wq! -To-save it and leave it out.
=====the COMMAND you CAN TYPE into YOUR console======
#systemctl Restart Iptables.service//restart the firewall for taking effect
#systemctl Enable Iptables.service//configure the Iptables service automatically reboot when the system Starts up
Notice that:21 Port is the FTP server ' s port, however, the ports which was needed on the passive mode of the VSFTPD AR E from 10060 ports to 10090 ports, these ports you can define by yourself, it's up to you.
##############################################################################
3. Close SELINUX
Vim/etc/selinux/config
: wq! To save and leave it out.
=====the COMMAND you CAN TYPE into YOUR console======
#setenforce 0//enable configuration to take effect immediately
##############################################################################
4. Install VSFTPD
=====the COMMAND you CAN TYPE into YOUR console======
#yum install-y vsftpd//install vsftpd
#install install-y psmisc net-tools systemd-devel libdb-devel perl-dbi
# Systemctl Start Vsftpd.service
#systemctl Enable Vsftpd.service
##############################################################################
5. Configure vsftpd server ' s configuation file
=====the COMMAND you CAN TYPE into YOUR console======
#cp/etc/vsftpd/vsftpd.conf/etc/vsftpd/vsftpd.conf-bak
anon_upload_enable=noanon_mkdir_write_enable=yesdirmessage_enable=yesxferlog_enable=yesconnect_from_port_20= Yeschown_uploads=yes#xferlog_file=/var/log/xferlogxferlog_std_format=yesidle_session_timeout=300data_ connection_timeout=1#nopriv_user=ftpsecureasync_abor_enable=yesascii_upload_enable=yesascii_download_enable= Yesftpd_banner=welcome to Blah FTP service. #deny_email_enable =yes#banned_email_file=/etc/vsftpd/banned_ emailschroot_local_user=yes#chroot_list_enable=yes#chroot_list_file=/etc/vsftpd/chroot_list#ls_recurse_enable= Yeslisten=nolisten_ipv6=yespam_service_name=vsftpduserlist_enable=yestcp_wrappers=yesuse_localtime=yeslisten_ Port=21guest_enable=yesguest_username=vsftpduser_config_dir=/etc/vsftpd/vconfvirtual_use_local_privs=yespasv_ Min_port=10060pasv_max_port=10090accept_timeout=5connect_timeout=1allow_writeable_chroot=yes
##############################################################################
6. Create a virtual user list file
=====the COMMAND you CAN TYPE into YOUR console======
#touch/etc/vsftpd/virtusers
#vim/etc/vsftpd/virtusers
web1123456web2123456web3123456
: wq! To save and leave it out.
##############################################################################
7. Generate a virtual user data file
=====the COMMAND you CAN TYPE into YOUR console======
#db_load-T-t hash-f/etc/vsftpd/virtusers/etc/vsftpd/virtusers.db
#chmod 600/etc/vsftpd/virtusers.db
##############################################################################
8. edit/etc/pam.d/vsftpd file and add some information as below
=====the COMMAND you CAN TYPE into YOUR console======
#cp/etc/pam.d/vsftpd/etc/pam.d/vsftpd.backup
#vim/etc/pam.d/vsftpd
Auth sufficient/lib64/security/pam_userdb.so Db=/etc/vsftpd/virtusersaccount SUFFICIENT/LIB64/SECURITY/PAM_ Userdb.so db=/etc/vsftpd/virtusers
Note That:if Your system is 32bit system, you can modify lib64 into lib, or you'll fail to configure it correct.
##############################################################################
9. Create A System user VSFTPD, its home directory is/home/wwwroot, set user Login console As/bin/false (the order to dis Able its login function)
=====the COMMAND you CAN TYPE into YOUR console======
#useradd vsftpd-m-d/home/wwwroot-s/bin/false
##############################################################################
Create the configuration file for the virtual user vsftpd
=====the COMMAND you CAN TYPE into YOUR console======
#mkdir/etc/vsftpd/vconf
#cd/etc/vsftpd/vconf
#touch Web1 web2 web3
#mkdir-P/home/wwwroot/web1/http/
#mkdir-P/home/wwwroot/web2/http/
#mkdir-P/home/wwwroot/web3/http/
#vim Web1
Local_root=/home/wwwroot/web1/http/write_enable=yesanon_world_readable_only=noanon_upload_enable=yesanon_mkdir _write_enable=yesanon_other_write_enable=yes
#vim WEB2
Local_root=/home/wwwroot/web2/http/write_enable=yesanon_world_readable_only=noanon_upload_enable=yesanon_mkdir _write_enable=yesanon_other_write_enable=yes
#vim WEB3
Local_root=/home/wwwroot/web3/http/write_enable=yesanon_world_readable_only=noanon_upload_enable=yesanon_mkdir _write_enable=yesanon_other_write_enable=yes
##############################################################################
Restart VSFTPD Server
=====the COMMAND you CAN TYPE into YOUR console======
#systemctl Restart Vsftpd.service
##############################################################################
Thank for your reading!
That's all, at the same time, it's my pleasure to share something I know, hope it'll be helpful for you.
##############################################################################
Setup and Configure the VSFTPD server in CentOS 7 operation system