vsftpd virtual users to build

1.vim /etc/selinux/config
SELINUX=disable

2.setenforce 0

3.yum install -y vsftpd

4.cp /etc/vsftpd/vsftpd.conf{,.bak}

5.vim / etc / vsftpd / vir_user
(singular behavior of the user name, password double the number of behavior)
user1
password1

6. generates virtual user database:
yum the install -Y-utils libdb
db_load the hash -T -t -f / etc / the vsftpd / vir_user /etc/vsftpd/vir_user.db
the chmod 700 /etc/vsftpd/vir_user.db

/Etc/pam.d/vsftpd{,.bak} 7.cp
Vim /etc/pam.d/vsftpd (commented previously configured, add the following two lines in the back)
the auth required pam_userdb.so DB = / etc / the vsftpd / vir_user
Account required pam_userdb.so DB = / etc / the vsftpd / vir_user

8.mkdir /ftproot
useradd -d /ftproot -s /sbin/nologin virftp
chown -R virftp:virftp /ftproot

8. Set the master configuration file
vim /etc/vsftpd/vsftpd.conf (no additions, modifications and some not)
# prohibit anonymous user login
anonymous_enable = NO
# allow local users to log
local_enable = YES
# Enable virtual account
guest_enable = YES
# the virtual account is mapped to the system account virftp
guest_username = virftp
# using a virtual user authentication (PAM verification)
pam_service_name = vsftpd
# set store directory for each virtual user profiles (with the virtual user name the same file for his configuration file in this directory)
= user_config_dir / etc / vsftpd / vsftpd_viruser
# enabled chroot, the virtual root directory allows users write
allow_writeable_chroot = YES

9. Create a virtual user configuration file
mkdir / etc / vsftpd / vsftpd_viruser / user1 ( user name)
vim / etc / vsftpd / vsftpd_viruser / user1
# allowed to write
YES write_enable =
# allows you to browse FTP directory and download
anon_world_readable_only = NO
# allow virtual users to upload files
anon_upload_enable = YES
# allows users to create virtual directory
anon_mkdir_write_enable = YES
# allow virtual users to perform other operations (such as rename, delete)
anon_other_write_enable = YES
# upload the file mask, such as when 022, 755 upload directory permissions, file permissions to 644
anon_umask = 022
# specified virtual user virtual directory (the home directory of the virtual user login)
local_root = / ftproot / ADMIN /

mkdir -p /ftproot/admin
chown -R virftp.virftp /ftproot/admin/

10.vim / etc / vsftpd / ftpusers (all commented out)

11. Restart the vsftpd service
systemctl restart vsftpd
systemctl enable vsftpd

12. A port 21 open or close the firewall
systemctl stop firewalld
or
firewalld-cmd --add-port = 21 / tcp

13. The above detection FZ login

Guess you like

Origin blog.51cto.com/14375779/2426827