1. Install vsftpd
1 yum install vsftpd -y
2. Rename the default configuration file for recovery
1 cp ftpusers ftpusers.bak2 cp user_list user_list.bak3 cp vsftpd.conf vsftpd.conf.bak
3. Create a virtual FTP account and database file
1 Vim/etc/vsftpd/vusers. List # Add account and password 2 ftpuser # One account 3 ftppass # One Line password 4 ftpuser25 ftppass2
1 db_load-T-t hash-F vusers. List vusers. DB # If not, choose to install a yum install db4-utils2 chmod 600/etc/vsftpd/vusers .*
4. Create the FTP root directory and the system account mapped to the virtual user
1 mkdir /var/ftproot2 useradd -d /var/ftproot -s /sbin/nologin virtual3 chmod 755 /var/ftroot
5. Create a virtual user authentication File
1 VI/etc/PAM. d/vsftp. VU # Add the following content 2 # % PAM-1.03 auth required pam_userdb.so DB =/etc/vsftpd/vusers4 account required pam_userdb.so DB =/etc/vsftpd/vusers
6. Finally, change the main configuration file.
1 Vim/etc/vsftpd. conf2 anonymous_enable = No # reject anonymous user logon 3 local_enable = yes # enable virtual login 4 write_enable = yes # Enable FTP write permission 5 anon_umask = 0226 guest_enable = yes # Allow virtual User Login 7 guest_username = Virtual # specify the ing username of the virtual user 8 pam_service_name = vsftp. VU # specify the authentication File
7. Restart the vsftpd service: Service vsftpd restart
Open a browser to test
User name: ftpuser or ftpuser2
Password: ftppass or ftppass2
Configure virtual user logon in vsftp