1. Installation preparation
1.Close SELINUX
setenforce 0
Two. Install vsftpd service
1. First enter /usr/local/src inside
yum -y install vsftpd
2.Back up the vsftpd main configuration file
cp /etc/vsftpd/vsftpd.conf{,.bak}< /p>
Three. Configure vsftpd service accessed by virtual users
1. strong>vi /etc/vsftpd/vir_user
< p>2. Generate virtual user database:
yum -y install libdb-utils
db_load -T -t hash -f /etc/vsftpd/vir_user /etc/vsftpd/vir_user.db
chmod 700 /etc/vsftpd/vir_user.db
4. Configure vsftpd pam verification file
1. Modify the previous backup file
cp /etc/pam.d/vsftpd{,.bak}
2.Comment out all the configuration lines of auth and account and add the following two lines
vi /etc/pam.d/vsftpd
5. Add a system user’virftp’ , All virtual users will be mapped to this user to read and write to the file system
mkdir /ftproot
useradd -d / ftproot -s /sbin/nologin virftp
chown -R virftp:virftp /ftproot
6. Set vsftpd main configuration file
vi /etc/vsftpd/vsftpd.conf (add if not)
7. Configure the respective configuration files of virtual users
1 . Create a storage directory for’virtual user configuration files’
mkdir /etc/vsftpd/vsftpd_viruser/
2. Create and configure virtual Each user’s configuration file, the file name is’virtual username’
vi /etc/vsftpd/vsftpd_viruser/long
mkdir -p /ftproot/admin/
chown -R virftp.virftp /ftproot/admin/< /p>
8. Test configuration results
1. Restart vsftpd Service
systemctl restart vsftpd
systemctl enable vsftpd
2.Turn off the firewall
systemctl stop firewalld< /p>
9. Open my computer
1.Enter ftp://IP address
Then A login interface will appear (enter the virtual user and password created by yourself)
After entering, right click to create a new folder
If you cannot create a new folder, enter
setsebool -P allow_ftpd_full_acces s on and
setsebool -P ftp_home_dir on
Then restart vsftpd
systemctl restart vsftpd
After entering, create a new folder again
< p>2.Enter cmd on Windows
Enter the ftp IP address
3.Use the’FlashFXP’ tool to connect and test
The host should be written as ftP: //IP address (port 21)
< p>
4. at root (The port is 22)
< p>If the login is successful
Go to cd /etc/vsftpd
ls view
vi ftpusers (comment out all the contents)
Then log in again, and it is correct if the login is unsuccessful