Summary of vsftp configuration in centos

Source: Internet
Author: User
Tags ftp centos iptables reverse dns


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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.