CentOS 7 installed VSFTPD virtual use

1. Installation preparation

1.Close SELINUX

setenforce 0

Two. Install vsftpd service

1. First enter /usr/local/src inside

yum -y install vsftpd
centos 7 install vsftpd virtual use

2.Back up the vsftpd main configuration file

cp /etc/vsftpd/vsftpd.conf{,.bak}< /p>

Three. Configure vsftpd service accessed by virtual users

1.vi /etc/vsftpd/vir_user
centos 7 install vsftpd virtual use

< p>2. Generate virtual user database:

yum -y install libdb-utils
centos 7 install vsftpd virtual use
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
centos 7 installation Virtual use of 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)
centos 7 install vsftpd virtual use
centos 7 install vsftpd virtual use

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
centos 7 install vsftpd virtual use

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
centos 7 install vsftpd virtual use

Then A login interface will appear (enter the virtual user and password created by yourself)
centos 7 install vsftpd virtual use

After entering, right click to create a new folder

centos 7 install vsftpd virtual use

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
centos 7 install vsftpd virtual use

3.Use the’FlashFXP’ tool to connect and test

The host should be written as ftP: //IP address (port 21)
centos 7 install vsftpd virtual use

< p>centos 7 install vsftpd virtual use
4. at root (The port is 22)

centos 7 install vsftpd virtual use

< p>If the login is successful

Go to cd /etc/vsftpd

ls view

vi ftpusers (comment out all the contents)
centos 7 install vsftpd virtual use

Then log in again, and it is correct if the login is unsuccessful
centos 7 install vsftpd virtual use

Leave a Comment

Your email address will not be published.