1. Install vsftpd
- vsftp uses the local user login method
- yum -y install vsftpd
- yum installed version 3.0.2
2. Configure vsftpd
- vim /etc/vsftpd/vsftpd.conf
anonymous_enable=YES
local_enable=YES
write_enable=YES
local_umask=022
xferlog_enable=YES
connect_from_port_20=YES
xferlog_std_format=YES
ascii_upload_enable=YES
ascii_download_enable=YES
chroot_local_user=YES
listen=NO
listen_ipv6=YES
pam_service_name=vsftpd
userlist_enable=YES
userlist_deny=NO
tcp_wrappers=YES
When the anonymous user login is turned off, the created ftp user cannot log in, so it is turned on.
anonymous_enable=YES
The default welcome message exposes the version number, which is commented out directly
dirmessage_enable=YES
Add ftp users to the login whitelist
echo 'ftpuser' >> /etc/vsftpd/user_list
3. Create ftp user and ftp directory
Here, the ftp user home directory is directly designated as the ftp data storage directory. save trouble
useradd ftpuser -s /sbin/nologin -d /data/ftp
set password
passwd ftpuser
vsftpd: refusing to run with writable root inside chroot()
Starting with vsftpd 2.3.5, the chroot directory where the user is locked is not writable. This is to prevent security breaches.
A safe way to allow uploads is to keep chroot enabled, and configure your FTP directorychmod a-w /data/ftp/
start vsftp
systemctl start vsftpd