FTP Server (FTP Server)

File Transfer Protocol (FTP) is a standard protocol used for transferring files over a network. It belongs to the application layer of network transmission protocols.

FTP is an 8-bit client-server protocol that can operate on any type of file without requiring further processing, similar to MIME or Unicode. However, FTP has extremely high latency, which means the time from the initial request to the first receipt of the requested data can be very long, and there are often lengthy login procedures that must be executed.

Overview

FTP services generally operate on ports 20 and 21. Port 21 is used for data flow transmission between the client and server, while port 20 is used for control flow transmission and is the command input to the FTP server. When data is transmitted via the data flow, the control flow is idle. When the control flow is idle for a long time, the client's firewall may timeout its session, which can lead to issues when a large amount of data is being transmitted through the firewall. In this case, while the file may be successfully transmitted, the control session may be terminated by the firewall, resulting in transmission errors.

Although FTP can be used directly by end users, it is designed to be controlled by FTP client programs.

Many sites that run FTP services offer anonymous services, allowing users to log in to the server without an account. By default, the username for anonymous users is "anonymous." This account does not require a password, although it typically asks for the user's email address as an authentication password, but this is just a detail, and the email address may not be validated at all, relying instead on the configuration of the FTP server.

Objectives of FTP Implementation

  • Facilitate file sharing (computer programs or data)
  • Encourage indirect or implicit use of remote computers
  • Hide the details of various file storage systems on different hosts from users
  • Reliable and efficient data transmission

Disadvantages

  • Passwords and file contents are transmitted in plaintext, which may lead to unwanted eavesdropping.
  • Because a random port must be opened to establish a connection, it can be difficult for clients to filter FTP traffic in active mode when a firewall is present. This problem is largely resolved by using passive mode FTP.
  • The server may be told to connect to a third-party computer's reserved port.
  • This method performs poorly when a large number of small files need to be transferred.

Active and Passive Modes

FTP has two operational modes: active and passive. Active mode requires both the client and server to open and listen on a port to establish a connection. In this scenario, the client may encounter some issues due to the firewall. Therefore, passive mode was created. Passive mode only requires the server to create a process that listens on the corresponding port, which circumvents issues caused by firewalls on the client side.

The steps to establish an FTP connection in active mode are as follows:

  • The client opens a random port (port number greater than 1024, referred to as x) while an FTP process connects to the server's port 21 for commands. At this point, the source port of the TCP connection is the client's designated random port x, and the destination port (remote port) is port 21 on the server.
  • The client begins listening on port (x+1) and sends a port command to the server (through port 21), indicating to the server the port number the client is listening on and that it is ready to receive data from that port. This port is known as the data port.
  • The server opens source port 20 and establishes a connection with the client's data port. At this point, the source port is 20, and the remote data (destination) port is (x+1).
  • The client establishes a connection to the server's port 20 through its original data port and sends a response to the server, indicating that it has established a connection.

FTP and Web Browsers

Most modern web browsers and file managers can connect to FTP servers. This allows remote files to be manipulated through an interface just like local files. This functionality is implemented by providing an FTP URL in the form of ftp:// (for example, ftp://ftp.gimp.org). Providing a password is optional; if present, it takes the form ftp://:@. Most web browsers require the use of passive FTP mode; however, not all FTP servers support passive mode.


How to Choose a Touchscreen?

Answers & Suggestions

How to Choose an Interactive Whiteboard?

Answers & Suggestions

Benefits of Recording Classes

Answers & Suggestions

知識學院

蘊藏許多助人的知識與智慧。

關注知識學院