Table of Contents
FTP

FTP, or File Transfer Protocol, is a standard network protocol used to transfer files between a client and a server over a network, such as the Internet or an intranet. It facilitates the movement of files from one machine to another, allowing users to upload, download, and manage files on remote servers.
FTP (File Transfer Protocol) is a standard network protocol used for the transfer of files from one host to another over a TCP-based network, such as the Internet.
FTP works by opening two connections that link the computers trying to communicate with each other. One connection is designated for the commands and replies that get sent between the two clients, and the other channel handles the transfer of data. During an FTP transmission, there are four commands used by the computers, servers, or proxy servers that are communicating. These are “send,” “get,” “change directory,” and “transfer.”
While transferring files, FTP uses three different modes: block, stream, and compressed. The stream mode enables FTP to manage information in a string of data without any boundaries between them. The block mode separates the data into blocks, and in the compress mode, FTP uses an algorithm called the Lempel-Ziv to compress the data.
How FTP Works

Connection Setup:
- Control Connection: FTP uses two separate channels to transmit data: the control connection (usually on port 21) and the data connection. The control connection handles commands and responses between the client and the server.
- Data Connection: For actual file transfers, FTP opens a separate data connection. This can be either active or passive, affecting how the client and server establish the connection.
Active Mode:
- The client opens a port and waits for the server to connect to it for data transfer. The server initiates the data connection from its side to the client’s specified port.
Passive Mode:
- The server opens a port and the client connects to it for data transfer. This mode is often used when clients are behind firewalls or NAT, making it easier for the client to establish the data connection.
Types of FTP
FTP (File Transfer Protocol) has several variations and related protocols designed to meet different needs, primarily in terms of security and functionality. Here are the main types:
1. Standard FTP:
- Description: The original protocol for transferring files over a network. It operates in plaintext, meaning that both commands and data are sent without encryption.
- Ports Used: Control connection on port 21; data connection can use a different port depending on mode.
2. FTPS (FTP Secure or FTP-SSL):
- Description: An extension of FTP that adds support for SSL/TLS encryption, which secures the data and command channels against interception and tampering.
- Types:
- Implicit FTPS: Encrypts the entire session from the beginning. It usually operates on port 990.
- Explicit FTPS: Starts as a standard FTP session but can be upgraded to a secure session using the
AUTH TLS
command. It typically operates on port 21.
3. SFTP (SSH File Transfer Protocol or Secure File Transfer Protocol):
- Description: A protocol that provides file access, transfer, and management over a secure SSH (Secure Shell) connection. It is not related to FTP but often confused due to its similar purpose.
- Ports Used: Typically operates on port 22, the same port used by SSH.
4. TFTP (Trivial File Transfer Protocol):
- Description: A simpler version of FTP with minimal features. It lacks authentication and encryption, and is used primarily for transferring files in a simple, quick manner. It’s often used in environments where security is not a concern.
- Ports Used: Operates on port 69.
5. FTP over HTTP (HTTP/FTP or Web-Based FTP):
- Description: A method to provide FTP functionality over an HTTP interface. Users interact with FTP servers through a web browser using HTTP or HTTPS.
- Ports Used: Typically uses ports 80 (HTTP) or 443 (HTTPS).
Summary:
- Standard FTP is the base protocol.
- FTPS adds encryption to standard FTP.
- SFTP is a different protocol that uses SSH for secure file transfers.
- TFTP is a lightweight, insecure protocol for simple file transfers.
- FTP over HTTP provides FTP functionality via a web browser interface.
Each type serves different use cases and requirements, particularly concerning security and ease of use. For secure file transfers, FTPS and SFTP are recommended over standard FTP.