yum install vsftpd
[root@localhost ~]# yum -y install vsftpd
Create virtual user and password
root@localhost ~]# cd /etc/vsftpd/
[root@localhost vsftpd]# vim vuser.list
aaaaa
1234
aaaa
1234
Single behavior user name double behavior password
Create database file
[root@localhost vsftpd]# db_load -T -t hash -f vuser.list vuser.db
Improve the security of virtual users
[root@localhost vsftpd]# chmod 600 /etc/vsftpd/vuser.*
[root@localhost vsftpd]# ls -lh /etc/vsftpd/vuser.*
-rw-------. 1 root root 12K Dec 25 18:14 /etc/vsftpd/vuser.db
-rw-------. 1 root root 21 Dec 25 18:14 /etc/vsftpd/vuser.list
Create a mapped account
[root@localhost vsftpd]# useradd -s /sbin/nologin -d /var/ftproot along
[root@localhost vsftpd]# chmod -R 777 /var/ftproot/
Create PAM certification file
cd /etc/pam.d/
vim vsftpd
1 to 8 plus # plus two lines
9 auth required pam_userdb.so db=/ etc/vsftpd/vuser
10 account required pam_userdb.so db=/ etc/vsftpd/vuser
Modify the main configuration file
[root@localhost pam.d]# cd /etc/vsftpd/
[root@localhost vsftpd]# ls
ftpusers vsftpd.conf vuser.db
user_list vsftpd_conf_migrate.sh vuser.list
[root@localhost vsftpd]# cp vsftpd.conf vsftpd.conf.bak
[root@localhost vsftpd]# vim vsftpd.conf
{allow_writeable_chroot=YES
anon_umask=022
anon_mkdir_write_enable=YES
chroot_local_user=YES
guest_enable=YES
guest_username=along
user_config_dir=/etc/vsftpd/users (this is not originally available and needs to be written manually)}
查看
[root@localhost vsftpd]# cat vsftpd.conf | grep -v “^$” | grep -v “^#”
anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=022
dirmessage_enable=YES
xferlog_enable=YES
connect_from_port_20=YES
xferlog_std_format=YES
listen=NO
listen_ipv6=YES
pam_service_name=vsftpd
userlist_enable=YES
tcp_wrappers=YES
allow_writeable_chroot=YES
anon_umask=022
anon_mkdir_write_enable=YES
chroot_local_user=YES
guest_enable=YES
guest_username=along
user_config_dir=/etc/vsftpd/users
Create a users directory file and create a configuration file for each virtual user
[root@localhost vsftpd]# mkdir users
[root@localhost vsftpd]# cd users
[root@localhost users]# vim aaaa
anon_world_readable_only=NO
anon_other_write_enable=YES
anon_umask=022
local_root=/var/ftproot/admin
[root@localhost users]# vim aaaaa
anon_mkdir_write_enable=YES
write_enable=YES
anon_world_readable_only=NO
anon_other_write_enable=YES
anon_umask=022
local_root=/var/ftproot/admin
Increase permissions and comment out users under ftpusers
[root@localhost users]# mkdir /var/ftproot/admin
[root@localhost users]# chown -R along.along /var/ftproot/admin/
[root@localhost users]# cd …
[root@localhost vsftpd]# vim ftpusers
#Users that are not allowed to login via ftp
#root
#bin
#daemon
#adm
#lp
#sync
#shutdown
#halt
#mail
#news
#uucp
#operator
#games
#nobody
前面都加上#
Turn off the firewall and lower the sandbox level and restart the service
[root@localhost vsftpd]# systemctl stop firewalld
[root@localhost vsftpd]# setenforce 0
[root@localhost vsftpd]# systemctl restart vsftpd
Client authentication and FileZille authentication
[root@localhost users]# ftp 192.168.1.222
Connected to 192.168.1.222 (192.168.1.222).
220 (vsFTPd 3.0.2)
Name (192.168.1.222:root): aaaaa
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp>