Get the App
SLTechnology News&Howtos  ›  Network Security  › 

Vsftpd configure virtual user

Shulou Source: shulou.com Published: 2022-06-01 06:02:15 10月04日 Update

Configuration steps:

1. Add a virtual user password file

Vim / etc/vsftpd/vuser.txt (Note: vuser.txt is defined by myself, can be any custom) candy # username 123 # password limingyu # username 123456 # password

two。 Generate virtual user password authentication

Yum install-y db4-utils # install db_load-T-t hash-f / etc/vsftpd/vuser.txt / etc/vsftpd/vuser.db# first without this tool to convert text documents into databases

3. Edit vsftpd's PAM authentication file

All other lines of vim / etc/pam.d/vsftpdauth required pam_userdb.so db=/etc/vsftpd/vuseraccount required pam_userdb.so db=/etc/vsftpd/vuser# are commented out, and write the above two lines # comment out other lines, which can prevent local users from logging in, because the verification of local users when logging in depends on this file

4. Establish locally mapped users and set host directory permissions

Useradd-d / home/vsftproot-s / sbin/nologin vuser# this user does not need to log in, but the mapping user # user name must be consistent with chmod 755 / home/vsftproot in the next configuration file

5. Modify the configuration file

Vim / etc/vsftpd/vsftpd.confguest_enable=YES# opens the system user pam_service_name=vsftpd#pam authentication file corresponding to the virtual user guest_username=vuser#ftp (default exists)

6. Restart the service and test

Service vsftpd restart or / etc/init.d/vsftpd restart # at this time, virtual users can log in, view, download, and cannot upload # the default upload location is the host user's home directory, and the anonymous user rights used by permissions are managed.

7. Adjust virtual user rights

Vim / etc/vsftpd/vsftpd.confanonymous_enable=NO# disables anonymous user login, which is more secure (does not affect virtual user login) anon_upload_enable=YESanon_mkdir_write_enable=YESanon_other_write_enable=YES# sets permissions for virtual users and allows all virtual users to upload

Tags: User file login permissions configuration user name authentication password host password comment directory consistency security location just tools data database steps Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker macOS Linux Huawei OPPO Reno