⚙️ FTP Protocol: Basic Structure
FTP (File Transfer Protocol) is a protocol that works with a client-server architecture. It connects over TCP/IP using port 21. There are two main channels:
-
Control Channel: the channel where commands are sent and replies are received.
-
Data Channel: the channel where the file transfer takes place.
🔁 Active and Passive Modes
| Mode | Description |
|---|---|
| Active | The server connects back to the client for the data connection (port 20). |
| Passive | The client opens the data connection on the port specified by the server. |
Passive mode is better suited to clients behind NAT and firewalls.
🔐 Security Layers
The FTP protocol has no encryption. That is why secure alternatives are preferred:
-
FTPS (FTP Secure): encrypts FTP traffic with SSL/TLS.
-
SFTP (SSH File Transfer Protocol): provides file transfer over SSH; it is not related to FTP but serves a similar purpose.
🧪 Commands and Reply Codes
FTP clients use the commands defined in RFC 959. Examples:
📤 Common FTP Commands
| Command | Description |
|---|---|
USER |
Sends the user name |
PASS |
Sends the password |
LIST |
Gets the file list |
RETR |
Downloads a file |
STOR |
Uploads a file |
DELE |
Deletes a file |
QUIT |
Ends the session |
📥 Reply Codes
| Code Range | Meaning |
|---|---|
| 1xx | Positive preliminary reply |
| 2xx | Successful operation |
| 3xx | More information needed |
| 4xx | Temporary error |
| 5xx | Permanent error |
Example: 220 – Server ready, 530 – Login failed.
🖥️ Technical Features of FTP Programs
FileZilla (open source)
-
Protocol support: FTP, FTPS, SFTP
-
Connection management: tabbed connections, site manager
-
Debugging: detailed logging
-
Upload queue: file management with a queue system
WinSCP
-
SFTP/FTP/FTPS support
-
Scripting and automation: PowerShell integration
-
GUI + CLI: supports both a graphical interface and the command line
🧰 FTP Server Software
| Server Software | Platform | Features |
|---|---|---|
| vsftpd | Linux | Secure, fast, low resource usage |
| ProFTPD | Linux | Apache-like configuration |
| FileZilla Server | Windows | Easy setup, GUI support |
🔄 Automation and Integration
FTP tasks are often automated:
-
Cron job / Task Scheduler: scheduled transfers
-
CI/CD integration: deploying files after a build
-
FTP client via API: Python (ftplib), PHP (ftp_* functions)
