Networking - File Transfer Protocol

 FTP (File Transfer Protocol):

  1. 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.

  2. Purpose: It enables users to upload, download, rename, delete, and manage files on a remote server.

  3. Protocol Type: FTP is an application-layer protocol in the OSI model and works on top of TCP.

  4. Port Numbers:

    • Default control connection uses port 21.

    • Data transfer may occur on port 20 (active mode) or a random port (passive mode).

  5. 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.

  6. Connection Types: FTP uses two separate channels:

    • Control Channel → for commands and responses.

    • Data Channel → for actual file transfer.

  7. Authentication: FTP usually requires a username and password, but anonymous FTP allows access without credentials.

  8. 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).

  9. Supported Operations:

    • Uploading files

    • Downloading files

    • Renaming files

    • Deleting files

    • Listing directories

    • Creating directories

  10. 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

  11. Client-Server Model: FTP works on a client-server architecture where the client requests services and the server responds.

  12. FTP Clients: Examples include FileZilla, WinSCP, Cyberduck, and command-line FTP tools.

  13. Anonymous FTP: Many public servers allow downloading files without authentication by using the username "anonymous".

  14. Data Transfer Modes:

    • ASCII Mode → for text files

    • Binary Mode → for images, videos, software, etc.

  15. Speed: FTP is generally faster than HTTP for large file transfers, especially when using optimized clients.

  16. Firewall Issues: FTP can face problems with firewalls and NAT, especially in active mode; passive mode solves this.

  17. Logging & Monitoring: FTP servers often maintain logs of user activity for security and auditing purposes.

  18. Integration: FTP is widely used for website management, software distribution, backups, and data exchange between systems.

  19. 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

  20. Alternatives: Modern alternatives to FTP include SFTP, FTPS, HTTP/HTTPS downloads, cloud storage APIs, and WebDAV.