How to Use vsftpd virtual users to manage Apache Virtual Hosts
According to the online tutorials, we sorted out how to use vsftpd virtual users to manage Apache Virtual Hosts. It was really convenient to find out, so we made a record. My system is CentOS 6.5 64-bit.
# Install the required package
Yum install-y pam vsftpd db4 db4-utils
# Httpd users are used as vsftpd ing users to facilitate management of various virtual hosts. My httpd users are apache
Create a file that records the user name and password of the vsftpdvirtual user (vuser_vsftpd_login.txt is used here)
# Format: one user name, one password, and multiple user branches.
# Example:
Vi/etc/vsftpd/vuser_vsftpd_login.txt
Vuser_aiplaypc.com
123456
Chmod 600/etc/vsftpd/vuser_vsftpd_login.txt
# Use the db_load command to generate a virtual user authentication File
Db_load-T-t hash-f/etc/vsftpd/vuser_vsftpd_login.txt/etc/vsftpd/vuser_vsftpd_login.db
Chmod 600/etc/vsftpd/vuser_vsftpd_login.db
# Note that after each new virtual user is added, run the db_load command to update the virtual user authentication file, that is, vuser_vsftpd_login.db.
# Back up the vsftpd configuration file, clear the content of vsftpd. conf, and rewrite a vsftpd. conf file.
Cp/etc/vsftpd/conf/vsftpd. conf/etc/vsftpd/conf/vsftpd. conf. default
Vi/etc/vsftpd/conf/vsftpd. conf
##### Start with vsftpd. conf #####
Anonymous_enable = NO
Local_enable = YES
Write_enable = YES
Local_umask = 022
Dirmessage_enable = YES
Connect_from_port_20 = YES
# Log function. If enabled, remove comments.
# Xferlog_enable = YES
# Xferlog_file =/var/log/vsftpd. log
Xferlog_std_format = YES
Listen = YES
Userlist_enable = YES
Tcp_wrappers = YES
Max_per_ip = 5
Max_clients = 200
Guest_enable = YES
# Enable the virtual User Function
Guest_username = apache
# Map all virtual users to the apache local user, and use httpd user apache for ing so that you can manage the website directory.
Pam_service_name =/etc/pam. d/ftp. vu
# Ftp users' pam Authentication Method
User_config_dir =/etc/vsftpd/vuser_conf
# Place the directory of the configuration file for each virtual user, one file for one user
##### End vsftpd. conf #####
# Create the verification file mentioned in vsftpd. conf.
Cp/usr/share/doc/vsftpd-2.2.2/EXAMPLE/VIRTUAL_USERS/vsftpd. pam/etc/pam. d/ftp. vu
Vi/etc/pam. d/ftp. vu
# Content of the original ftp. vu file:
Auth required/lib/security/pam_userdb.so db =/etc/vsftpd/login
Account required/lib/security/pam_userdb.so db =/etc/vsftpd/login
# For the modified content of ftp. vu, if it is a 32-bit system, change the path after the = sign.
Auth required/lib64/security/pam_userdb.so db =/etc/vsftpd/vuser_vsftpd_login
Account required/lib64/security/pam_userdb.so db =/etc/vsftpd/vuser_vsftpd_login
# Create a directory for storing the virtual user configuration file
Mkdir/etc/vsftpd/vuser_conf
# Create a configuration file for a vsftpd virtual user. The best file name is the user name, which is easy to find. The content is as follows:
Vi/etc/vsftpd/vuser_conf/vuser_aiplaypc.com
##### Starting from virtual user configuration #####
Anon_world_readable_only = no
# Users can browse and download files, but cannot set it to yes; otherwise, files cannot be viewed.
Write_enable = yes
# Users can create files
Anon_upload_enable = yes
# Users can upload files
Anon_mkdir_write_enable = yes
# Permission for creating and deleting Directories
Anon_other_write_enable = yes
# You have the permission to rename and delete files.
Local_root =/home/web/html
# Specify the Home Directory of the virtual FTP user. The html here is the root directory of your virtual host.
##### End of virtual user configuration #####
# Use the "yes" and "no" parameters in the virtual user configuration file to control ftp user permissions based on actual conditions, or delete the corresponding statements
By now, the configuration of managing apache Virtual Hosts by using vsftpd virtual users is complete. Restart vsftpd to log on and manage web files by using virtual users. If you cannot log on, view the settings of iptables and selinux.
For more vsFTPd tutorials, see the following:
Four Advanced configurations of vsftpd Server:
VsFTPd configuration Tutorial:
Simple and practical Ubuntu FTP setup
Set up FTP server and Apache server on Ubuntu
Install the LAMP \ vsftpd \ Webmin \ phpMyAdmin service and settings in Ubuntu 13.04
Simple case of anonymous uploading of SeLinux and vsftpd on the RHEL6 Platform
Install vsftpd source code in Linux
Install and configure the FTP server vsftpd in openSUSE 13.2/13.1
This article permanently updates the link address: