How to configure vsftpd virtual account

  

1. Install software

yum -y install vsftpd*yum -y install pam*yum -y install db4*

2. Create virtual account association System account

useradd virftp -s /sbin/nologin

3. Create virtual account related files

touch /etc/vsftpd/vsftpd_login

And write the user you want to create, the odd line is the user name, the even line is the password. For example:

ftpuser1121212ftpuser212121212

Then generate the corresponding library file

db_load - T -t hash -f /etc/vsftpd/vsftpd_login /etc/vsftpd/vsftpd_login.db

4. Create a virtual account related directory and configuration file

mkdir /etc/vsftpd/vsftpd_user_conf

Then in the directory, create a virtual account corresponding configuration file, account and file name corresponding

cd /etc/vsftpd/vsftpd_user_conf

vim ftpuser1 content is as follows:

local_root=/home/virftp/ftpuser1anonymous_enable=NOwrite_enable=YESlocal_umask=022anon_upload_enable=NOanon_mkdir_write_enable=NOidle_session_timeout=600data_connection _timeout=120max_clients=10max_per_ip=5local_max_rate=50000

Create the home directory of ftpuser1 mentioned in the configuration file

mkdir /home/virftp/ftpuser1

Modify permissions:

chown -R virftp:virftp /home/virftp/

5. Modify the verification file

vim /etc/pam.d/vsftpd Add two lines at the beginning

auth sufficient /lib/security/pam_userdb.so db=/etc/vsftpd/vsftpd_loginaccount sufficient /lib/security/pam_userdb.so db=/etc/vsftpd/vsftpd_login

6. Modify vsftpd.conf

as follows:

anonymous_enable = NOlocal_enable = YESwrite_enable = YESlocal_umask = 022anon_upload_enable = NOanon_mkdir_write_enable = NOdirmessage_enable = YESxferlog_enable = YESconnect_from_port_20 = YESxferlog_file = /var /log /vsftpd.logxferlog_std_format = YESnopriv_user = vsftpdasync_abor_enable = YESascii_upload_enable = YESascii_download_enable=YESftpd_banner=Welcome to FTP service.listen=YESchroot_local_user=YESpam_service_name=vsftpduserlist_enable=YEStcp_wrappers=YESguest_enable=YESguest_username=virftpvirtual_use_local _privs=YESuser_config_dir=/etc/vsftpd/vsftpd_user_conf

7. Start vsftpd service

/etc/init.d/vsftpd start

8. Test

lftp localhost -u ftpuser1,121212

See if you can log in normally. If it is not normal, please check the /var/log/secure file and analyze the log

Copyright © Windows knowledge All Rights Reserved