---
title: "Short note: FTP"
subject: "Internet and Intranet"
chapter: 3
key: "semester_8/internet_and_intranet:note-ftp"
source: https://www.bctengineer.com/q/semester_8/internet_and_intranet/note-ftp
site: BCT Engineering
---

# Short note: FTP

Internet and Intranet · Chapter 3: Protocols and Client/Server Applications

- Asked in: 2074 Bhadra, 4 marks
- Video: [FTP (File Transfer Protocol), SFTP, TFTP Explained.](https://www.youtube.com/watch?v=tOj8MSEIbfA) — PowerCert Animated Videos
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_8/internet_and_intranet/note-ftp
- Whole chapter: https://www.bctengineer.com/md/semester_8/internet_and_intranet/chapter-3

## Question

Write a short note on FTP.

## Short answer

FTP uses two TCP connections: control on port 21 for commands and data on port 20 for transfers. It supports active and passive modes; secure alternatives are SFTP and FTPS.

## Answer

**File Transfer Protocol (FTP)** is an application layer protocol (RFC 959) used to transfer files between a client and a server over TCP. It is a client/server protocol with user authentication.

**Two connections**

- **Control connection**: TCP port **21**. It stays open for the whole session and carries commands (USER, PASS, LIST, RETR, STOR, CWD, QUIT) and replies (e.g. 220, 230, 226, 550). It is "out-of-band" control.
- **Data connection**: TCP port **20** in active mode. A new data connection is opened for every file transfer and closed after it.

```text
 FTP client                         FTP server
 [control] ---- TCP 21 commands --> [control]
 [data]    <--- TCP 20 files ------> [data]
```

**Modes**

- **Active mode:** the server opens the data connection from port 20 to the client's port. Often blocked by client firewalls/NAT.
- **Passive mode (PASV):** the server opens a random port and the client connects to it. Firewall friendly.

**Features**

- Transfer type: ASCII or binary; transmission mode: stream.
- FTP keeps **state** about the user (current directory, login).
- Supports anonymous access (user "anonymous", e-mail as password).
- Weakness: user name, password and data go as plain text. Secure alternatives are **SFTP** (over SSH) and **FTPS** (FTP over TLS).

Common clients: FileZilla, `ftp` command; common servers: vsftpd, ProFTPD.

## Check yourself

The answer's key points as multiple-choice questions, with the correct option and why.

1. How does FTP use TCP connections?
   A. A single connection on port 21 for both commands and files
   B. A persistent control connection on port 21 and a data connection per file transfer (port 20 in active mode)
   C. UDP port 20 for commands and TCP port 21 for data
   D. One new connection on port 80 per command
   Answer: B. Control stays open for the session on port 21; a new data connection is opened for each transfer and closed afterwards. (Key point: Two connections)

2. What happens in passive mode?
   A. The server opens the data connection to the client's port
   B. The server opens a random port and the client connects to it, which is firewall friendly
   C. Data goes over the control connection
   D. The client disconnects after login
   Answer: B. In passive (PASV) mode the client initiates the data connection, avoiding blocks from client firewalls and NAT. (Key point: Active vs passive mode)

3. What is the main security weakness of FTP, and a secure alternative?
   A. Passwords and data are sent as plain text; use SFTP or FTPS
   B. It has no authentication; use HTTP
   C. It uses UDP; use TCP
   D. It only allows anonymous login; use POP3
   Answer: A. FTP sends credentials and data unencrypted; SFTP (over SSH) and FTPS (FTP over TLS) are secure alternatives. (Key point: FTP weakness)
