I searched a lot of materials online, outdated, incomplete, and incorrect version.
The test is effective in the next step, excluding anonymous user logon.
1. Create/home/loguser.txt
And fill the content in the following format:
User Name
Password
User Name
Password
User Name
Password
2. Generate db files for user verification
Run db_load-T-t hash-f/home/loguser.txt/etc/vsftpd_login.db
If the database is not installed, you will be prompted to apt-get install. Enter the command according to the prompts and run the command again to generate the db.
3. Set Database File Access Permissions
chmod 600 /etc/vsftpd_login.db
4. Edit the/etc/pam. d/vsftpd. vu file and add the following content to the first two lines of the original file:
auth required pam_userdb.so db=/etc/vsftpd_loginaccount required pam_userdb.so db=/etc/vsftpd_login
Create
5. Create a New System User vsftpd. the user's home directory is/home/vsftpd, and the user logon terminal is set to/bin/false (even if the user cannot log on to the system)
sudo useradd vsftpd -d /home/vsftpd -s /bin/falsesudo chown vsftpd:vsftpd /home/vsftpd
6. Create/etc/vsftpd. conf as needed. Make sure that the following settings are included:
listen=NOanonymous_enable=NO dirmessage_enable=YES xferlog_enable=YES xferlog_file=/var/log/vsftpd.log xferlog_std_format=YES chroot_local_user=YES guest_enable=YES guest_username=vsftpduser_config_dir=/etc/vsftpd_user_conf pam_service_name=vsftpd.vu local_enable=YES secure_chroot_dir=/var/run/vsftpd
7. Create the/etc/vsftpd_user_conf directory.
Create a file corresponding to the user name in the first step in the directory. For example, if you have a user dbtest, you must create a dbtest file in this directory.
8. Configure the permissions of a single user to ensure that the content is in your dbtest.
write_enable=YESanon_world_readable_only=NO anon_upload_enable=YES anon_mkdir_write_enable=YES anon_other_write_enable=YES local_root=/home/vsftpd/dbtest
Note that no space is available before and after all configuration files. Otherwise, an error will be prompted during logon.
9. Create a directory corresponding to local_root and grant the 777 permission
Test upload download edit Delete
10. mount a virtual directory
For example, the default ftp directory is/srv/ftp. to map the/mnt/LinG/WinSoft folder to the/srv/ftp directory, run the following command:
# Mount -- bind [original directory] [new directory]
Create a folder first
sudo mkdir /srv/ftp/WinSoft
Run the mount command
Sudo mount -- bind/mnt/LinG/WinSoft/srv/ftp/WinSoft
Note that the attached virtual directory also requires 777 permissions.
For details about 500 OOPS: vsftpd: refusing to run with writable root inside chroot ()
In my opinion, you cannot have write permission in the main directory.
Here, you can set the master directory permission to 775.
Set the directory permission of the specified user to 777.
You can log on successfully.