First we assume that you have installed the VSFTPD and have created the following 3 subdirectories under the/HOME/VSFTPD directory
Dbzh1
Dbzh2
Dbzh3
Below, we are going to build 3 virtual users, password is the username and then add "00"
Db1
Db2
Db3
Makes
User DB1 's home directory is DBZH1, and only read-only permissions are available under this directory
User DB2 's home directory is DBZH2, and only read-only permissions are available under this directory
User Db3 's home directory is DBZH3 and has all permissions under that directory
Create a text file Loguser.txt
The format is as follows:
user_id
Password&http://www.aliyun.com/zixun/aggregation/37954.html ">NBSP;
So, the contents of our/home/loguser.txt file are
Db1
db100
Db2
db200
Db3
db300
Building a Database
If you've never had a libdb4.6-util before or you don't know what to do, you'll need to execute the following command
sudo apt install db4.6-util
Then we execute
sudo db4.6_load-t-t hash-f/home/loguser.txt/etc/vsftpd_login.db
Finally set the access rights of the database file
sudo chmod 600/etc/vsftpd_login.db
Configuring Pam Files
Edit File/etc/pam.d/vsftpd.vu Add the following to the previous two lines of the original file:
Auth required/lib/security/pam_userdb.so Db=/etc/vsftpd_login
Account Required/lib/security/pam_userdb.so Db=/etc/vsftpd_login
The database Vsftpd_login we established in the previous step is used here
The virtual user we created will be validated using Pam, which is enabled by the statement pam_service_name=vsftpd.vu in the/etc/vsftpd.conf file, which you will discover later.