CSS Prepare

optional · CSS study notes

FTP (File Transfer Protocol)

🧭

On this page — click any heading below to jump straight to it. ⬅️ Back to P-II.II. Computer Communications & Networks


OSI Layer: Application Layer (L7)

Definition

FTP (File Transfer Protocol) is a TCP-based application-layer protocol used to transfer files between a client and a server. Unlike HTTP, FTP is unusual in that it uses two separate, parallel TCP connections rather than one.

Two-Connection Model

  • Control connection — port 21, stays open for the whole session; carries commands (USER, PASS, LIST, RETR, STOR, QUIT) and server replies (status codes)
  • Data connection — port 20 (or a negotiated port in passive mode); opened separately for each file transfer or directory listing, then closed once that transfer finishes
  • Because control information travels out-of-band on its own connection, FTP differs from HTTP/SMTP, which send control information mixed in-band with the data

Active vs Passive Mode

  • Active mode — the server initiates the data connection back to the client; often blocked by client-side firewalls/NAT
  • Passive mode — the client initiates both connections to the server; the more firewall/NAT-friendly default used by most modern FTP clients

Common Commands

  • USER / PASS — authentication
  • LIST — request a directory listing
  • RETR — retrieve (download) a file
  • STOR — store (upload) a file
  • CWD — change working directory

Anonymous FTP

Many public FTP servers allow login with username "anonymous" and an email address as password, granting read-only access to public files — historically used for software mirrors and RFC archives.

CSS Exam Angle

  • The most commonly tested contrast is "FTP vs HTTP": both are TCP-based, but FTP's separate control/data connections and stateful session (tracking current directory) versus HTTP's single connection and statelessness is the key distinction to state explicitly
  • Mention that FTP transmits credentials in plaintext by default — a real security weakness, motivating SFTP/FTPS as secure alternatives

Example

A user uploading a website's files to a hosting server opens one FTP control connection to log in and issue commands, and the client software opens a fresh data connection for each individual file upload, closing it once that file completes — unlike a single persistent HTTP connection serving many small requests.

Likely Questions

  1. Explain FTP's two-connection (control and data) model.
  2. Differentiate active and passive FTP modes.
  3. Compare FTP and HTTP as application-layer protocols.
  4. What security weaknesses exist in plain FTP, and how are they addressed?

📜 Past-Paper Questions & Structured Answers

Questions are paraphrased; answer focus is suggested guidance, not an official marking scheme.

2020 · Paper-I · Q3(c) · application to FTP · 4 marks

Question (paraphrased): Which transport would you choose for an Internet file transfer?

Answer focus: Direct choice with file-specific justification.

TCP is suitable because a completed file should preserve every byte in order. TCP numbers bytes, acknowledges data and retransmits missing segments; its checksum detects corruption. Its ordered stream prevents reordering from changing the file content.

The setup and recovery overhead is normally acceptable because completeness outweighs a small delay. FTP uses separate TCP control and data connections. UDP alone would require the application to implement equivalent recovery and ordering.

2025 · Paper-II · Q3(a)(iv) · shared with HTTP/SMTP/POP3 · 2 marks

Question (paraphrased): Why do the named application protocols conventionally use TCP?

Answer focus: Two concise points, not a history of FTP.

They need reliable, ordered delivery of commands and data: missing or reordered bytes can corrupt files, messages or application responses. TCP supplies sequencing, acknowledgements and retransmission, while UDP alone leaves these functions to the application.

For modern accuracy, HTTP/3 achieves reliability through QUIC over UDP; the question uses the conventional TCP-based versions.

Related: the 2020 four-mark port question is answered in Servers, Server Types & Protocol Stack. FTP alone was not given four marks within that shared port list.