2. Use MySQL data files:
Create a local mapped user.
useradd -s /sbin/nologin vuser |
Modify /etc/vsfptd/ and add the following content.
guest_enable=YES |
Install MySQL and related software packages.
|
Create database and user tables in MySQL.
[root@polo ]# mysql -u root mysql -p |
Authorized vuser can read the users table of the ftpvuser database.
|
After the above authorization is completed, you can verify whether the authorization is successful through the following method.
Compile MySQL's PAM authentication module.
First, you need to download (/projects/pam-mysql) MySQL's PAM authentication module source code, decompress it using the tar command and compile it. The following packages need to be installed before compiling.
|
./configure |
After editing, you can check whether there is a corresponding pam module in the /lib/security directory (as shown below).
Modify the pam authentication file /etc//vsftpd and comment on the original content.
auth required pam_mysql.so user=vuser passwd=123 host=localhost db=ftpvuser table=users usercolumn=name passwdcolumn=passwd crypt=2 |
After the above two virtual user configurations are completed, different configuration files can be specified for each virtual user through the following steps.
1. Modify /etc/vsfptd/
user_config_dir=/etc/vsftpd/vuserconf |
2. In the /etc/vsfptd/ directory, create a configuration file with the user name of each virtual user.
5. Virtual host.
By default, vsftp does not create multiple ftp sites on the same host like IIS, but there is not a way to create multiple ftp sites on the same host. The method is as follows:
1. Add a virtual IP address (eth0's IP address 192.168.0.10)
ifconfig eth0:0 192.168.0.11/24 |
|
3. Prepare the configuration file for the virtual FTP server
cp /etc/vsfptd/ /etc/vsfptd/ |
listen_address=192.168.0.10 |
listen_address=192.168.0.11 |