& Nbsp; 1. create a virtual user database # vi/tmp/logins.txt. its content is longyufei1985731liushuai123456 virtual user information. format: <username> <password> (note that there is no space before and after !) 2. use root
1. create a virtual user database
# Vi/tmp/logins.txt:
Longyufei
1985731
Liushuai
123456
Virtual user information, format:
<User name>
<Password>
(Note that there cannot be spaces before and after !)
2. log on to the system as a root user and create a user database
# Db_load-T-t hash-f/tmp/logins.txt/etc/vsftpd_login.db
Create a database file/etc/vsftpd_login.db and change its file attributes:
# Chmod 600/etc/vsftpd_login.db
3. create a PAM file and tell the system that you want to use your own database.
# Vi/etc/pam. d/ftp. vu
Content:
Auth required/lib/security/pam_userdb.so db =/etc/vsftpd_login
Account required/lib/security/pam_userdb.so db =/etc/vsftpd_login
Tell the system that the new user authorization library is in place.
4. create folders and authorize virtual users
# Useradd-d/ftp-s/sbin/nologin virtual (-d user's home directory. -S: the default shell and virtual username used by the user name)
# Chown-R virtual. virtual/ftp (change/ftp directory user .)
5. modify the vsftpd. conf file
# Vi/etc/vsftpd. conf, and add it to the end (my configuration only retains the following content ):
Anonymous_enable = NO
Local_enable = YES
Connect_from_port_20 = YES
Listen = YES
Listen_port = 21
Tcp_wrappers = YES
Guest_enable = YES
Guest_username = virtual (all virtual users are equivalent to the permission of the virtual system account)
User_config_dir =/etc/vsftpd/user_config_dir (specify the configuration directory for each virtual user account ,)
Pam_service_name = ftp. vu (to correspond to the PAM file just created)
Local_root =/www (specify the default ftp directory. if not set, the default ftp directory is the default directory of the ftp system account (see/etc/passwd file content ))
The longyufei user configuration file corresponding to the user_config_dir file:
/Etc/vsftpd/user_config_dir/longyufei
Anon_world_readable_only = NO
Write_enable = YES
Anon_upload_enable = YES
Anon_other_write_enable = YES
Local_root =/www/longyufei
Anon_mkdir_write_enable = YES