FTP (File Transfer Protocol) is one of the protocols in the TCP/IP protocol group. FTP protocol consists of two components, one is the FTP server, and the other is the FTP client. The FTP server is used to store files, and users can use the FTP client to access resources located on the FTP server through the FTP protocol.
When developing a website, the FTP protocol is usually used to transfer web pages or programs to the Web server. In addition, because FTP transmission efficiency is very high, this protocol is generally used when transmitting large files on the network. (Recommended learning: web front-end video tutorial)
By default, the FTP protocol uses TCP ports 20 and 21, of which 20 is used for data transmission and 21 is used for transmission. control information. However, whether to use port 20 as the data transmission port is related to the transmission mode used by FTP. If active mode is used, the data transmission port is 20; if passive mode is used, the final port to be used must be decided through negotiation between the server and the client.
Like most Internet services, FTP is also a client/server system. Users connect to a server program running on a remote computer through a client program. The computer that provides services according to the FTP protocol and transfers files is the FTP server, and the computer that connects to the FTP server and transfers files with the server in accordance with the FTP protocol is the FTP client.
To connect to the FTP server, users must use FTP client software. Usually Windows comes with the "ftp" command, which is a command line FTP client program. Other commonly used FTP client programs include FileZilla, CuteFTP, Ws_FTP, Flashfxp, LeapFTP, Meteor Shower-Maoyan, etc.
FTP supports two modes, one is called Standard (that is, PORT mode, active mode), and the other is Passive (that is, PASV, passive mode). Standard mode FTP client sends the PORT command to the FTP server. Passive mode FTP client sends PASV command to FTP Server.
The following is an introduction to the working principles of these two methods:
Port
#FTP client first and The TCP port 21 of the FTP server establishes a connection and sends commands through this channel. When the client needs to receive data, it sends a PORT command on this channel. The PORT command contains the port used by the client to receive data. When transmitting data, the server connects to the client's designated port through its own TCP 20 port to send data. The FTP server must establish a new connection with the client to transfer data.Passive
When establishing a control channel, it is similar to the Standard mode, but after establishing the connection, the Pasv command is sent instead of the Port command. After receiving the Pasv command, the FTP server randomly opens a high-end port (the port number is greater than 1024) and notifies the client of the request to transmit data on this port. The client connects to this port of the FTP server, establishes the channel through a three-way handshake, and then the FTP server Data is transmitted through this port.The above is the detailed content of What are the main security issues of ftp. For more information, please follow other related articles on the PHP Chinese website!