Detailed VSFTP configuration under linux

One, install VSFTP

1、yum install vsftp -y

2. rpm -qc vsftpd / view the location of the vsftp installation file

Two, configure VSFTP

1. Configure anonymous access to VSFTP

File introduction: vsftpd.conf ----The main configuration file of vsftp

ftpusers---------Blacklisted users

user_list---------Whitelist users, that is, users who can access ftp

 

2. Start the service systemctl start vsftp.service

systemctl enable vsftpd.service -----------Set ftp to start automatically

3. Check the ftp listening port netstat -anput | grep :21

Three, configure to allow anonymous users to access ftp

Edit the vsftp.conf file,

anonymous_enable=YES------------Activate anonymous access
anon_upload_enable=YES----------Allow anonymous upload of files
anon_mkdir_write_enable=YES----Allow anonymous creation of directories
anon_other_write_enable=YES- ---Allow anonymously rename files or folders, or delete files or folders

Modify ftp shared folder permissions

chown -R ftp.ftp /var/www/pub

Fourth, configure user name and password to access FTP

The shared folder is still /var/www/pub/

1. Create an ftp account

useradd -s /sbin/nologin user1

echo "123456" |passwd --stdin user1--------------Set user1 password (passwd -user1)

2. Configure the vsftp.conf file

anonymous_enable=NO

local_enable=YES

local_root=/var/www/pub--------Set FTP shared home directory

chroot_list_enable=YES------Activate the chroot function

chroot_list_file=/etc/vsftpd/chroot_list ----Set the list file of the locked user in the root directory, this file saves the user name to be locked, such as user1

allow_writeable_chroot=YES------allows locked users to have write permissions

3. Create a chroot_list file and set the file permissions to 644

touch /etc/vsftpd/chroot_list

chmod -R 644 /etc/vsftpd/chroot_list

vim  /etc/vsftpd/chroot_list

    user1

   user2

4. Modify ftp home directory folder permissions

chmod -R o+w /var/www/pub/

5. Modify the /etc/pam.d/vsftp file

Comment out or modify the line auth required pam_shells.so to auth required pam_nologin.so

5. Restart the service systemctl restart vsftpd.service

Five, test

The client can use filelliza (windows) or lftp (Linux) to log in

lftp 192.168.11.93 -u user1,123456

After logging in, check the files under pub through ls. If the reality is normal, it proves that there is no problem.

 

 

 

 

Guess you like

Origin blog.csdn.net/zjc801/article/details/109249353