- 2074 Bhadra · 4 marks
Short note: 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.
Write a short note on FTP.
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.
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.
✓ Answer checked by Claude Opus 5.5 (high effort)