1. Introduction
FTP is the abbreviation for file Transfer Protocol (document Transfer Protocol), and Chinese is called "Interfax protocol". Used for two-way transmission of control files on the Internet. At the same time, it is also an application (application). There are different FTP applications based on different operating systems, and all of these applications follow the same protocol to transfer files. In the use of FTP, users often encounter two concepts: "Download" (Download) and "Upload" (Upload).
Generally in a variety of Linux distributions, the default with the FTP software is vsftp, from the various Linux distributions to vsftp recognition can be seen, vsftp should be a good FTP software.
2. Installing the VSFTP Component
2.1 Checking and installing the VSFTPD software
Command: #rpm-qa |grep vsftpd
I've installed it, so I'm going to show vsftpd information.
2.2 If it is not installed, install it using the Yum command.
Command: # yum-y Install VSFTPD
The/ETC/VSFTPD folder is generated when the installation is complete
There are three main profiles under this folder:
Ftpusers This file is used to specify that those users cannot access the FTP server.
User_list the default account that the file uses to indicate that the FTP is not accessible by default
Vsftpd.conf VSFTPD's master configuration file
After installation, there is a/etc/vsftpd/vsftpd.conf file, which is the vsftp configuration file.
3. Start the service
Using VSFTPD software, mainly includes the following commands:
Start ftp command #service vsftpd start
Stop FTP command #service vsftpd stop
Restart FTP command #service vsftpd restart
4. Anonymous User Login
Comment out the configuration file vsftpd.conf the following content
Anon_upload_enable=yes
Anon_mkdir_write_enable=yes
This completes the configuration of the anonymous user, at which point the anonymous user can log on to upload and download files.
The service needs to be restarted after the configuration file has been modified.
5. Non-anonymous user login
VSFTPD services are associated with system users, such as when we create a new user, the user can implement a login with the default configuration
Create User: Dedicated to log on to the FTP server
Command: # useradd Ftpuser
Set the FTP user password
Command: # passwd Ftpuser
Create a user to complete, you can use the account login, remember to use normal login do not use Anonymous. The default path after login is/home/ftpuser
6. External network access
FTP Server default port 21,centos default, open firewall 21 port, modify iptables manual Open
Or just shut down the firewall: command: # service iptables stop
Edit Config file command: # vim/etc/sysconfig/iptables
On the line there is 22-jaccept below another line input is similar to that row, just change 22 to 21, then: Wq save.
Restart Iptables
Command: # service iptables restart
7. Modifying SELinux
Outside the network can be accessed up, but found unable to return to the directory (using FTP active mode, passive mode is still inaccessible), also cannot upload, because SELinux mischief.
Execute the following command to view the status:
Command: # Getsebool-a | grep FTP
Execute the above command, see the return result of the yellow two lines are off, the representative, no access to open the network
To open a command:
Command: # setsebool-p allow_ftpd_full_access on
Command: # setsebool-p Ftp_home_dir on
8. Turn off anonymous access
Edit vsftp configuration file: vi/etc/vsftpd/vsftpd.conf
Anonymous_enable default Yes to NO
Restart Services: # service VSFTPD Restart
9. Turn on Passive mode
The default is on, but to specify a port range, open the vsftpd.conf file, and add the following
pasv_min_port=30000
pasv_max_port=30999
Indicates that the port range is 30000~30999, this can be changed arbitrarily. Restart the vsftpd after the change.
Because this port range is specified, the Iptables also opens the range accordingly, so open the Iptables file as above.
Also in 21 up and down on the other side of the line, the more similar, just 21 to 30,000:30,999, then: Wq save, restart the next iptables. So it's done.
10. Set Boot VSFTPD FTP service
# Chkconfig VSFTPD on
11. Access via Browser
Note that FTP service, not HTTP service, if you want to access through the HTTP service, can be implemented via Nginx
Reference Address: 80726828
12. Using Client Login (FileZilla)
Download: Open source software, download the website can
The interface is as follows:
Add a site (in fact, connect the FTP server information settings):
After the connection can upload the download file:
Linux Installation Vsftp Service