FTP
A historic file protocol with separate control and data channels. Prefer SFTP/HTTPS.
Level: beginner
What is it?
File Transfer Protocol (FTP) is a legacy application protocol that commonly uses a control connection and a separate data connection. Classic FTP does not encrypt credentials or file data by default.
Why does it matter?
FTP illustrates control/data channel design and active versus passive connection setup. Its lack of built-in confidentiality and integrity makes plain FTP unsuitable for sensitive traffic over untrusted networks.
Mental model
One channel carries commands and replies; another carries file listings or file contents. Firewall and NAT configuration can become complicated because data-connection setup differs between active and passive modes.
How it works
- The control connection commonly uses TCP port 21; data connections are separate and vary by mode.
- Active mode asks the server to connect back to a client-selected endpoint; passive mode lets the client initiate the data connection to a server-advertised endpoint.
- Plain FTP transmits credentials and content without TLS protection.
- FTPS adds TLS to FTP but retains its multi-channel model; SFTP is a different file-transfer protocol built over SSH.
- Modern deployments usually prefer SFTP, HTTPS, or a managed file-transfer design with clear authentication and audit controls.
Steps
- The client opens the FTP control connection and authenticates.
- It sends a command such as LIST, RETR, or STOR.
- The client and server negotiate or establish the data channel according to active/passive mode.
- Commands and data complete, and the control connection is closed.
Real-world usage
- Understanding legacy file-transfer systems and firewall troubleshooting.
- Migrating sensitive file transfer to SFTP or HTTPS.
Common mistakes
- Confusing FTP, FTPS, and SFTP as the same protocol.
- Using plain FTP for passwords or sensitive files on untrusted networks.
- Ignoring the extra data connection when debugging firewall behavior.
Interview questions
What is the difference between FTP and SFTP?
FTP is a separate control/data protocol; SFTP is a file-transfer subsystem carried over SSH and is not FTP wrapped in a different port.
Why can passive FTP help through NAT?
The client initiates the data connection to the server's advertised passive port, avoiding a server-initiated inbound connection to the client's private address.