☼
⌃
☰

File Transfer Protocol

Table of Contents

File Transfer Protocol

FTP (File Transfer Protocol) is a network protocol used for transferring

files between computers over a network. It provides a simple and

efficient way to upload and download files, making it a popular choice

for file sharing and distribution.

Diagram

PLANTUML
@startuml
title FTP Protocol

participant Client
participant Server

activate Client

Client -> Server: Connect to Server (Port 21)
activate Server

Server --> Client: Welcome Message, Server Information
Client -> Server: User <username>
Server --> Client: 331 User name okay, need password
Client -> Server: Pass <password>
Server --> Client: 230 User <username> logged in

Client -> Server: List
Server --> Client: 125 Data connection already open; transfer starting
Client -> Server: Receive file listing

Client -> Server: Retrieve <filename>
Server --> Client: 150 File status okay; about to open data connection.
Server --> Client: Open Data Connection (Port 20)
Client -> Server: Receive file <filename>

Client -> Server: Store <filename>
Client -> Server: 150 File status okay; about to open data connection.
Client -> Server: Open Data Connection (Port 20)
Client -> Server: Send file <filename>

deactivate Server
deactivate Client

@enduml

Key Features

  • Client-server architecture: FTP operates on a client-server model, where a client (e.g., a web browser) connects to an FTP server to transfer files.
  • Directory navigation: FTP allows users to navigate through directories on both the client and server sides.
  • File transfer: FTP supports the transfer of files in both directions, allowing users to upload and download files.
  • Binary and ASCII transfer modes: FTP can transfer files in binary or ASCII mode, depending on the file type.

FTP Commands

FTP uses a command-line interface to interact with the server. Common

FTP commands include:

  • OPEN: Connects to an FTP server.
  • USER: Specifies the username for authentication.
  • PASS: Specifies the password for authentication.
  • PWD: Displays the current working directory on the server.
  • CD: Changes the working directory on the server.
  • LS: Lists the contents of the current directory on the server.
  • GET: Downloads a file from the server.
  • PUT: Uploads a file to the server.
  • QUIT: Disconnects from the FTP server.

FTP Security Concerns

While FTP is a widely used protocol, it has some security vulnerabilities.

To mitigate these risks, it is recommended to use secure FTP (SFTP) or FTPS (FTP over Secure Sockets Layer), which encrypt data in transit.

FTP Alternatives

  • SFTP (Secure File Transfer Protocol): A more secure version of FTP that uses SSH for encryption.
  • FTPS (FTP over SSL/TLS): Another secure version of FTP that uses SSL/TLS for encryption.
  • SCP (Secure Copy Protocol): A command-line utility that uses SSH for secure file transfers.