1. Establish the Virtual User Password library file
Odd line in Password Vault file set user name, even line set password
# Vi/etc/vsftpd/ftpuser.txt
Ftpaaa
123456
ftpbbb
123456
2. Generate VSFTPD Certification Documents
Install a package called "Db4-utils-..."
# db_load-t-T hash-f/etc/vsftpd/logins.txt/etc/vsftpd/ftplogin.db
Note: If you do not have the Db_load command, please install the db4-utils-* related RPM package.
Set the authentication file to user-readable writable only
# chmod 600/etc/vsftpd/ftplogin.db
3. Create Pam profiles for virtual users
# VI/ETC/PAM.D/VSFTPD.VU
Auth required/lib64/security/pam_userdb.so Db=/etc/vsftpd/ftplogin
Account Required/lib64/security/pam_userdb.so Db=/etc/vsftpd/ftplogin
Note: The last 2 filenames in the above 2 lines FTPLogin and the database names in the 2nd step must match!
These are the 64-bit systems used
The 32-bit system is as follows:
Vi/etc/pam.d/vsftpd.vu
Auth sufficient/lib/security/pam_userdb.so Db=/etc/vsftpd/ftplogin
Account Sufficient/lib/security/pam_userdb.so Db=/etc/vsftpd/ftplogin
4, establish the virtual user to access the directory and set the appropriate permissions
# useradd-d/home/ftpsite Virtual (user name, can be changed to another name)
# chmod 700/home/ftpsite/
After the setup of this step,/home/ftpsite is the master directory of the virtual user, who is also the owner of the Ftpsite directory. Except for the root user, only the user has permission to read, write, and execute the directory.
5. Setting vsftpd.conf configuration file
Guest_enable=yes Default configuration does not have this line
Guest_username=virtual Default configuration does not have this line
Pam_service_name=vsftpd.vu Default is VSFTPD
Virtual_use_local_privs=yes Set Virtual user permissions to match their host users
Chroot_local_user=yes prohibit local users from logging out of their own FTP home directory
Other default configurations are modified to suit your needs
6. Setting up the main configuration file
Add user profile directory settings in the vsftpd.conf file
User_config_dir=/etc/vsftpd_user_conf
The effect of increasing the upstream is to set the permissions of each user and then create the appropriate user profile in the user profile directory, such as creating a profile for the user named Ftpaaa above.
#vi/ETC/VSFTPD_USER_CONF/FTPAAA
Anon_world_readable_only=no readable downloadable
Anon_upload_enable=yes can be uploaded
Anon_mkdir_write_enable=yes to create and delete folders
Anon_other_write_enable=yes file Rename and delete files
LOCAL_ROOT=/HOME/FTPSITE/FTPAAA Specifies the host directory of the FTPAAA (all users are logged on to/home/ftpsite by default, and then log in to the specified directory when specified)
Also create a profile for FTPBBB users
Vi/etc/vsftpd_user_conf/ftpaaa
Note: The user profile name is the same as the user name
7. Create the user's specified login directory (if Local_root is not configured, do not create, because the default login to/home/ftpsite)
Mkdir/home/ftpsite/ftpaaa
Chown VIRTUAL:VIRTUAL/HOME/FTPSITE/FTPAAA
chmod 700/home/ftpsite/ftpaaa
8, start to VSFTPD service
Service VSFTPD Start
Virtual User Configuration method for Vsftp