FTP

File Transfer ProtocolApplication layer · OSI 7

Dual-connection file transfer and why encryption replaced it

Step 1 of 6: Open control link on port 21. Your laptop opens a TCP socket to port 21 on ftp.example.com , and the server sends a 220 greeting . This channel carries commands for the entire session without encryption.
0.0 s / 25.9 s
Your laptop192.168.1.10
HandshakeResponseRequestData

Overview

copies files using two separate TCP connections: one control channel for commands, and a new data connection for each file or directory listing. Standard FTP sends logins and files in plain text.

File Transfer Protocol (RFC 959) keeps a persistent control connection on TCP port 21 while opening ephemeral data connections per transfer. Modern deployments use SFTP (over ) or FTPS (RFC 4217).

Key facts

Layer
Application (over TCP)
Control port
TCP 21
Data socket
Separate TCP connection per file
Encryption
None in classic FTP
Safer options
SFTP (over SSH) or FTPS

Two connections finished the download

Port 21 handled commands while port 50069 carried the file bytes, and closing the data socket marked the end of the file. Modern systems replace classic FTP with SFTP or FTPS to encrypt passwords and data.

Completed RFC 959 passive FTP transfer: port 21 control, port 50069 data handshake, 4,000-byte binary stream, FIN EOF signaling, and 221 close.

Connections
2 (port 21 control + port 50069 data)
Transferred
4,000 B across 3 segments
Classic flaw
Credentials and files unencrypted
Encrypted alternatives
SFTP or FTPS

Try it yourself

Prefer SFTP over SSH on the command line

SFTP runs inside an encrypted SSH connection on port 22 instead of classic plain-text FTP.

sftp alice@example.com