Operating system: centos7.0 64-bit
Using VSFTPD to build an FTP service
1.yum Install VSFTPD
2. Start/restart/shutdown VSFTPD Server
[Email protected] ftp]#/sbin/service vsftpd restart
Shutting down VSFTPD: [OK]
Starting vsftpd for VSFTPD: [OK]
OK indicates that the restart was successful.
Start and close the restart change to Start/stop respectively.
If the source is installed, go to the installation folder to find the start.sh and shutdown.sh files, execute them.
3. Files and folders related to the VSFTPD server
The configuration file for the VSFTPD server is:/etc/vsftpd/vsftpd.conf
The root directory of the VSFTPD server, which is the home directory of the FTP server:
In the pub at the/var/ftp Place
If you want to modify the path of the server directory, then you just need to modify the/var/ftp anywhere else.
4. Add FTP Local Users
Some FTP servers require a user name and password to log in, because FTP users and permissions are set.
FTP users are generally unable to log on to the system, only to enter the FTP server's own directory, which is for security. This is called a virtual user. In fact, it is not a real virtual user, just can't log in to the shell, not the ability to log in the system.
/usr/sbin/adduser-d/opt/test_ftp-g ftp-s/sbin/nologin test
The meaning of this command is:
Add test User using command (adduser), cannot log in system (-s/sbin/nologin), own folder in (-d/opt/test_ftp)), belong to group FTP (-G FTP)
Then you need to set the password for it passwd test
This adds an FTP user. The following example will help you get to the FTP server.
Modify Firewall
Vi/etc/sysconfig/iptables
Increase
# iptables-a input-p TCP--dport 21-j ACCEPT
# iptables-a input-p TCP--dport 20-j ACCEPT
# iptables-a Input-p TCP--dport 1024x768:-M State--state Established,related-j ACCEPT
Above reference: http://blog.csdn.net/kofterry/article/details/4277267
5. If the read list times out
1. Edit the VSFTPD configuration file
vi /etc/vsftpd/vsftpd. conf
Add the following information at the bottom
Pasv_enable=YES #开启被动模式
2. Load Kernel ip_conntrack_ftp and ip_nat_ftp (terminal execution)
Modprobe ip_conntrack_ftp
Modprobe ip_nat_ftp
6. Restart VSFTPD
Service vsftpd restart
FTP Service built under Linux