How FTP works

Source: Internet
Author: User
Tags ftp site ftp client file transfer protocol ftp protocol

This article describes FTP entries in Wikipedia.

FTP Server

Early FTP servers were in the form of command lines. Later, a graphical FTP tool was developed. CuteFTP and filezilla are commonly used.

Many Linux and Solaris have their own ftp tools.


Two FTP connections

FTP (file transfer protocol) is located at the application layer of the OSI model, used to transmit files,It is based on TCP/TP.
Therefore, an FTP server must run continuously and wait for requests from the client. After the connection is established, the client can communicate with the server through port 21. This connection is called "Controller connection". This port remains open throughout the session. The second connection, known as "Data Connection", can be Port 20 (active mode) Actively opened by the server, or a random port (passive mode ). This connection is used to transmit data.

The control connection is used to manage sessions, such as various commands, authentication, and password exchange between the server and the client (based on a telnet-like protocol ). Because of this dual-port structure, FTP is considered as the out-of-band protocol, which is opposite to the in-band protocol such as HTTP.

Two FTP working modes

FTP has two modes: Active Mode and passive mode.Both modes are initialized by the FTP client (determined)Which will be used by the FTP server.

Active Mode
In active mode, data connection always uses Port 20. Generally, FTP works in active mode by default.

Passive Mode
In passive mode, the FTP client uses an ephemeral port,
In this case, the client listens to its ephemeral port + 1 and sends port + 1 to the FTP server through port 21.
For example, if the currently used ephemeral port is 1026, the client starts listening to port 1027. Once completed, the FTP server will establish a connection to the FTP client port 1027.
The significance of the passive mode is that the ports used for data transmission are constantly changing, so that some firewalls can be bypassed. For example, if the firewall only releases ports like and (Port 20 is not enabled), the available ports can be automatically found and used in passive mode.

In addition, the so-called out-of-band means that the control data is separated from the real data transmission. FTP is the out-of-band control.

Anonymous connection
Many FTP servers provide anonymous connections. Users can directly connect to the FTP server anonymously. Of course, the permissions are limited. This feature is often used for automatic software updates.

Secure FTP protocol
If I remember correctly, FTP transmission is in plain text.

Therefore, due to installation factors, multiple secure FTP protocols are derived. There are three main types: ftps, SFTP, and FTP over ssh. Let's take a look at the Wiki.

Browser support
Common browsers support the FTP protocol. We can use a browser to view files on the FTP server, but generally do not support other functions such as uploading and deleting. For Firefox, a plug-in fireftp is provided to allow Firefox and FTP clients to support multiple operations.
At the same time, the browser may not support extended FTP protocols such as ftps. That is to say, if the FTP site uses the ftps protocol, your browser may not be able to access the FTP site.

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.