centos7 set up FTP

By yum install vsftpd

yum install -y vsftpd

Modify vsftpd configuration file

vim /etc/vsftpd/vsftpd.conf

Modify the configuration file as follows: 
1. Do not allow anonymous access

anonymous_enable=NO

2. Allow the use of a local user account for FTP login authentication

local_enable=YES

3. can not leave the user's home directory

chroot_local_user=YES
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd/chroot_list

By the following effects can be achieved with:
  ① When chroot_list_enable = YES, chroot_local_user = YES, the users listed in the file /etc/vsftpd.chroot_list can switch to another directory; user not listed in the document, not switch to a different directory.

 ② When chroot_list_enable = YES, chroot_local_user = NO, the
user /etc/vsftpd.chroot_list listed in the file, can not switch to another directory; user not listed in the document, can switch to another directory.

 ③ When chroot_list_enable = NO,
when chroot_local_user = YES, all users can not switch to another directory.

 ④ When chroot_list_enable = NO,
when chroot_local_user = NO, all users can switch to another directory.
4. Create chroot_list file, add users on demand

vim /etc/vsftpd/chroot_list

ins enter 
esc +: wq to save and exit

5. Set supports ASCII mode, upload and download.

ascii_upload_enable=YES
ascii_download_enable=YES

6. Finally add profile vsftpd.conf

allow_writeable_chroot=YES

Do not add will complain

500 OOPS: vsftpd: refusing to run with writable root inside chroot()

Third, the new FTP user

useradd -d /var/www/html -g ftp -s /sbin/nologin ftpuser

-d: home directory when a user logs into 
-g: User Group 
-s / sbin / nologin ftp for only specified user login, user login denied
 

Modify the FTP user password

passwd ftpuser

Fourth, set the boot

systemctl enable vsftpd.service
systemctl start vsftpd.service

 

Guess you like

Origin www.cnblogs.com/mrma/p/10308536.html