1. Introduction
FTP stands for File Transfer Protocol.
FTP is an application-layer protocol used to transfer files between a client computer and a server over a TCP/IP network.
In simple words:
FTP is a protocol that allows users to upload files to a server and download files from a server.
For example, a website developer can use FTP to upload:
- HTML files
- Images
- CSS files
- JavaScript files
- Documents
- Other website files
2. Basic Idea of FTP
FTP follows a client-server architecture.
FTP CLIENT
│
│
Upload / Download
│
↓
FTP SERVER
│
┌─────┼─────┐
│ │ │
Files Files Files
FTP Client
The FTP client is the software used by the user to connect to an FTP server.
Examples include:
- FileZilla
- WinSCP
- Command-line FTP client
FTP Server
The FTP server stores files and responds to requests from FTP clients.
3. Main Functions of FTP
FTP provides several file management functions:
- Upload files
- Download files
- Delete files
- Rename files
- Create directories
- Delete directories
- List files and directories
- Move between directories
- Authenticate users
4. How FTP Works
The basic FTP process is:
User
↓
FTP Client
↓
Connection to FTP Server
↓
Login / Authentication
↓
File Operations
↓
Upload / Download
↓
Disconnect
Step 1: FTP Client
The user opens an FTP client.
Step 2: Connect to FTP Server
The client connects to the FTP server using the server’s hostname or IP address.
Example:
ftp.example.com
Step 3: Authentication
The server may ask for:
Username
Password
Some servers also support anonymous FTP, where limited access may be provided without a personal account.
Step 4: Directory Listing
After login, the user can view available directories and files.
Step 5: File Transfer
The user can:
Upload:
Client ─────────► Server
Download:
Client ◄───────── Server
Step 6: Connection Termination
After completing the work, the client closes the FTP session.
5. FTP Uses Two Connections
This is a very important point for exams.
Traditional FTP uses two separate TCP connections:
- Control connection
- Data connection
FTP Client
/ \
/ \
Control Data
Connection Connection
│ │
↓ ↓
FTP Server FTP Server
A. Control Connection
The control connection is used for commands and responses.
Examples:
- Login
- List directory
- Change directory
- Download request
- Upload request
Traditional FTP uses TCP port 21 for the control connection.
B. Data Connection
The data connection is used for actual file data and directory listings.
For traditional FTP, the data connection uses a separate TCP connection.
The way this connection is established depends on whether FTP is operating in active mode or passive mode.
6. Active and Passive FTP
A. Active Mode
In active FTP, the server establishes the data connection back to the client.
Simplified:
Client ── Control ──► Server
Client ◄── Data ───── Server
A common issue with active mode is that firewalls or NAT devices on the client side may block the incoming data connection.
B. Passive Mode
In passive FTP, the client establishes both the control and data connections to the server.
Client ── Control ──► Server
Client ── Data ──────► Server
Passive mode is widely used because it works better with modern firewalls and NAT.
7. FTP Commands
FTP provides commands for performing different operations.
| Command | Purpose |
|---|---|
USER | Specifies username |
PASS | Specifies password |
LIST | Lists files/directories |
PWD | Shows current directory |
CWD | Changes directory |
RETR | Downloads a file |
STOR | Uploads/stores a file |
DELE | Deletes a file |
MKD | Creates a directory |
RMD | Removes a directory |
QUIT | Ends the FTP session |
Example
If a user wants to download:
notes.pdf
the client can issue an FTP RETR command for that file.
8. File Transfer Modes
FTP supports different ways of representing transferred data.
1. ASCII Mode
Used mainly for text files.
Examples:
- HTML
- TXT
- CSS
- Source code
2. Binary Mode
Used for files where the exact bytes must be preserved.
Examples:
- Images
- Videos
- PDF files
- Executable files
- ZIP files
For modern FTP clients, binary transfer is commonly used for non-text files.
9. Anonymous FTP
FTP can support anonymous access.
In anonymous FTP:
User
↓
FTP Server
↓
Anonymous Access
The server allows users to access selected public files without having a normal personal account.
Uses
- Public software distribution
- Public documents
- Research data
- Public archives
However, anonymous FTP access is normally restricted for security reasons.
10. FTP vs HTTP
Both FTP and HTTP can transfer files, but they have different purposes.
| Feature | FTP | HTTP |
|---|---|---|
| Full form | File Transfer Protocol | HyperText Transfer Protocol |
| Main purpose | File transfer and file management | Web pages and web resources |
| Architecture | Client-server | Client-server |
| Traditional FTP control port | 21 | 80 |
| Secure version | FTPS / SFTP* | HTTPS |
| Directory management | Supported | Not a core feature |
| Upload/download | Yes | Yes |
| Common use | Server file management | Web browsing |
Important: SFTP is SSH File Transfer Protocol, which is different from FTPS. SFTP is not simply “secure FTP”; it is a separate protocol that runs over SSH.
11. FTP vs SFTP
This is useful for practical understanding.
| FTP | SFTP |
|---|---|
| File Transfer Protocol | SSH File Transfer Protocol |
| Traditionally unencrypted | Encrypted through SSH |
| Uses separate FTP control/data connections | Uses one SSH-based connection |
| Less secure for sensitive data | More secure |
| Traditional FTP control port: 21 | Usually SSH port 22 |
For transferring sensitive files, SFTP is generally preferred over traditional FTP.
12. Advantages of FTP
1. Easy file transfer
Users can easily upload and download files.
2. Supports large files
FTP can be used to transfer large files.
3. File management
Users can create, delete, rename and organize files and directories, depending on permissions.
4. Authentication
FTP can use usernames and passwords to control access.
5. Resume capability
Many FTP clients can resume interrupted file transfers.
6. Useful for website management
Web developers can transfer website files between their computers and hosting servers.
13. Disadvantages of FTP
1. Traditional FTP is not encrypted
Usernames, passwords and transferred data can be exposed on an untrusted network.
2. Security risks
Traditional FTP is not suitable for transferring sensitive information over insecure networks.
3. Firewall/NAT issues
Active FTP can create connectivity problems with firewalls and NAT.
4. More complex than simple web downloads
FTP involves separate control and data connections.
5. Better secure alternatives exist
SFTP and FTPS provide stronger protection for secure file transfer.
14. Applications of FTP
FTP has been used extensively for:
1. Website development
Developers upload website files to web hosting servers.
Computer
↓
FTP
↓
Web Hosting Server
2. Software distribution
Files and software packages can be distributed through FTP servers.
3. Backup and file transfer
Organizations can transfer files between systems.
4. Sharing large files
FTP can be used to transfer large datasets and files.
5. Server administration
Administrators can manage files on remote servers when appropriate access is available.
15. FTP Working Example
Suppose you have created a website on your computer:
index.html
about.html
style.css
logo.png
You want to upload these files to your hosting server.
The process is:
YOUR COMPUTER
│
FTP Client
│
│ FTP
↓
HOSTING SERVER
│
┌─────┼─────┐
│ │ │
index about style
.html .html .css
After uploading, the web server can serve these files to visitors.
16. FTP Architecture Diagram
For a 10-mark answer, you can draw:
FTP SYSTEM
┌──────────────────┐
│ FTP CLIENT │
│ │
│ User / Browser │
└────────┬─────────┘
│
Control Connection
TCP Port 21
│
↓
┌──────────────────┐
│ FTP SERVER │
│ │
│ Files/Directories│
└────────┬─────────┘
↑
│
Data Connection
│
File Upload/Download
17. Important FTP Terms
| Term | Meaning |
|---|---|
| FTP | File Transfer Protocol |
| Client | Software/device requesting file services |
| Server | System providing file services |
| Upload | Client → Server |
| Download | Server → Client |
| Control Connection | Carries FTP commands/responses |
| Data Connection | Carries files/data |
| Port 21 | Traditional FTP control connection |
| Active Mode | Server initiates data connection |
| Passive Mode | Client initiates data connection |
| Anonymous FTP | FTP access without a normal personal account |
| SFTP | SSH File Transfer Protocol |
| FTPS | FTP secured with TLS |
18. Quick Revision
Remember these points:
FTP → File Transfer Protocol
Main purpose → Upload and download files
Architecture → Client-Server
Traditional control port → TCP 21
Two connections → Control + Data
Active FTP → Server establishes data connection
Passive FTP → Client establishes data connection
Traditional FTP → Not encrypted
SFTP → Secure file transfer over SSH
10-Mark Conclusion
File Transfer Protocol (FTP) is an application-layer protocol used to transfer files between a client and a server over a TCP/IP network. It supports operations such as uploading, downloading, renaming and deleting files. Traditional FTP uses a separate control connection, normally on TCP port 21, and a separate data connection for transferring files. FTP supports active and passive modes and can use authentication for controlled access. However, traditional FTP does not encrypt its communication, so secure alternatives such as SFTP or FTPS are preferred when security is important.
