Networking - File Transfer Protocol
FTP (File Transfer Protocol):
-
Definition: FTP (File Transfer Protocol) is a standard network protocol used to transfer files between a client and a server over a TCP/IP network.
-
Purpose: It enables users to upload, download, rename, delete, and manage files on a remote server.
-
Protocol Type: FTP is an application-layer protocol in the OSI model and works on top of TCP.
-
Port Numbers:
-
Default control connection uses port 21.
-
Data transfer may occur on port 20 (active mode) or a random port (passive mode).
-
-
Working Modes:
-
Active Mode: The server initiates the data connection to the client.
-
Passive Mode: The client initiates both control and data connections, often used when firewalls are involved.
-
-
Connection Types: FTP uses two separate channels:
-
Control Channel → for commands and responses.
-
Data Channel → for actual file transfer.
-
-
Authentication: FTP usually requires a username and password, but anonymous FTP allows access without credentials.
-
Security:
-
Standard FTP transfers data in plain text, making it insecure.
-
Secure variants include FTPS (FTP over SSL/TLS) and SFTP (SSH File Transfer Protocol).
-
-
Supported Operations:
-
Uploading files
-
Downloading files
-
Renaming files
-
Deleting files
-
Listing directories
-
Creating directories
-
-
FTP Commands: Common commands include:
-
USER
→ login username -
PASS
→ login password -
LIST
→ list files -
RETR
→ download a file -
STOR
→ upload a file -
DELE
→ delete a file
-
-
Client-Server Model: FTP works on a client-server architecture where the client requests services and the server responds.
-
FTP Clients: Examples include FileZilla, WinSCP, Cyberduck, and command-line FTP tools.
-
Anonymous FTP: Many public servers allow downloading files without authentication by using the username "anonymous".
-
Data Transfer Modes:
-
ASCII Mode → for text files
-
Binary Mode → for images, videos, software, etc.
-
-
Speed: FTP is generally faster than HTTP for large file transfers, especially when using optimized clients.
-
Firewall Issues: FTP can face problems with firewalls and NAT, especially in active mode; passive mode solves this.
-
Logging & Monitoring: FTP servers often maintain logs of user activity for security and auditing purposes.
-
Integration: FTP is widely used for website management, software distribution, backups, and data exchange between systems.
-
Limitations:
-
Lacks built-in encryption (unless using FTPS/SFTP)
-
Not suitable for highly secure data without extra security layers
-
Requires manual configuration in some cases
-
-
Alternatives: Modern alternatives to FTP include SFTP, FTPS, HTTP/HTTPS downloads, cloud storage APIs, and WebDAV.