Vsftpd Virtual user configuration reference-Ultimate Edition
Vsftpd Virtual user configuration document
I. list of major files
Virtual user list
Account.txt
Password base file
/ etc/vsfptd/account.db
PAM certification
/ etc/pam.d/vs_1
Master configuration file
/ etc/vsftpd.conf
Virtual user profile
/ etc/vsftpd/user_conf/aa
Virtual user home directory
/ home/vss/aa
2. Create a virtual user list file for vsftpd
Vi account.txt
Aa
123123
Bb
123123
Description: the location created by this file is customized
Third, generate password base files
Db_load-T-t hash-f. / account.txt / etc/vsftpd/account.db
Chmod 600 / etc/vsftpd/account.db
4. Establish PAM document
Vi / etc/pam.d/vs_1
Auth required / lib/security/pam_userdb.so db=/etc/vsftpd/account
Account required / lib/security/pam_userdb.so db=/etc/vsftpd/account
Note: first check whether Linux-PAM is installed in the system, and then determine whether the pam_userdb.so file exists and its path; note that there is no suffix in account writing.
Create a new virtual user of the system
Useradd-m-d / home/vss-s / sbin/nologin vss
Chmod 700 / home/vss
Note: under the Ubuntu system, the parameter-m needs to be added here.
6. Establish the virtual user home directory of vsftpd
Mkdir / home/vss/aa
Chown vss:vss / home/vss/aa
Mkdir / home/vss/bb
Chown vss:vss / home/vss/bb
7. Modify the main configuration file
Mv / etc/vsftpd.conf / etc/vsftpd.conf.bak
Vi / etc/vsftpd.conf
Anonymous_enable=NO
Allow_writeable_chroot=YES
Local_enable=YES
Local_umask=022
Xferlog_enable=YES
Connect_from_port_20=YES
Xferlog_std_format=YES
Listen=YES
Write_enable=YES
Anon_upload_enable=YES
Anon_mkdir_write_enable=YES
Anon_other_write_enable=YES
One_process_model=NO
Chroot_local_user=YES
Ftpd_banner=Welcom to my FTP server.
Anon_world_readable_only=NO
Guest_enable=YES
Guest_username=vs
Pam_service_name=vs_1
# local_root=/home/vs/
User_config_dir=/etc/vsftpd/user_conf
Note: for more information on the above parameters, please see http://www.sudu.cn/service/detail.php?id=11656.
Modify the configuration file of vsftpd virtual user
Mkdir / etc/vsftpd/user_conf
Vi / etc/vsftpd/user_conf/aa
Local_root=/home/vss/aa
Guest_username=vss
Virtual_use_local_privs=YES
Anon_umask=022
Anon_upload_enable=YES
Anon_mkdir_write_enable=YES
Anon_world_readable_only=NO
Anon_other_write_enable=YES
Vi / etc/vsftpd/user_conf/bb
Local_root=/home/vss/bb
Guest_username=vss
Virtual_use_local_privs=YES
Anon_umask=022
Anon_upload_enable=YES
Anon_mkdir_write_enable=YES
Anon_world_readable_only=NO
Anon_other_write_enable=YES
Restart the service and test the client
Service vsftpd restart
10. If you add a new vsftpd virtual user, follow these steps:
1. Add a user name and password to account.txt
2. Update password base files
3. Create the user's virtual home directory, such as / home/vss/cc, and grant the system user the right to vss.
4. Create a new profile for the user, such as / etc/vsftpd/user_conf/cc, and add its permissions