This article does not describe how to configure FTP, but takes notes to record the strange problems you may encounter.
The more I learn, the more I find my ignorance, and the more I say it is tears.
Do not forget to enable iptables
/Sbin/iptables-I INPUT-p tcp-dport 21-j ACCEPT
Restricted to your own directory
Chroot_local_user = NO (after numerous tests, it must be "NO", which is restricted to its own directory, not the YES written in other posts)
Chroot_list_enable = YES
Chroot_list_file =/etc/vsftpd/chroot_list
Put your account in chroot_list, one row.
Useradd-d/lenovo/mobile/x-g ftp-s/sbin/nologin testftp
/Sbin/service vsftpd restart
/Etc/vsftpd. conf
Slow connection to FTP
Like ssh, DNS reverse resolution is enabled for vsftp configuration files by default, which may lead to extremely slow user login to the FTP server, you only need to disable reverse DNS resolution in the configuration file to resolve the file.
Edit/etc/vsftpd. conf
Add
Reverse_lookup_enable = NO
After the vsftpd service is restarted, the problem is solved. Log on to the system and check if the number of seconds has elapsed ~
This solution prevents passive connections without opening more ports.
By configuring iptables to open only port 21, you can achieve active and passive connections to the client.
# Configure the most basic iptables rules
Iptables-F
Iptables-X
Iptables-a input-m state-state ESTABLISHED, RELATED-j ACCEPT
Iptables-a input-m state-state NEW-p tcp-dport 21-j ACCEPT
Iptables-a input-m state-state NEW-p tcp-dport 22-j ACCEPT
Iptables-P INPUT DROP
Iptables-P FORWARD DROP
/Sbin/iptables-I INPUT-p tcp-dport 21-j ACCEPT
# Saving iptables rules
Service iptables save
# Modify the/etc/sysconfig/iptables-config file
Change IPTABLES_MODULES = "" to IPTABLES_MODULES = "ip_nat_ftp"
# Restart iptables
Service iptables restart