FTP Documentation (File Transfer Protocol)

Introduction

FTP (File Transfer Protocol) is a network protocol used to transfer files between systems connected to the Internet or to local networks. This document covers the main aspects of FTP, from setup to everyday use.


Basic Concepts

  • FTP server: The computer or system that hosts the files.
  • FTP client: The software or tool used to access the server and transfer files.
  • Default port: FTP uses port 21 for the control connection.
  • Operating modes:
    • Active: The client tells the server where to send the data.
    • Passive: The server tells the client where to connect for the data transfer, which works better through firewalls.

FTP Server Setup

Requirements:

  1. An operating system that supports FTP (Linux, Windows, etc.).
  2. FTP server software (e.g. vsftpd, FileZilla Server, ProFTPD).

Setup steps:

  1. Install the server:
    • Linux (example with vsftpd):
      bash
      sudo apt update
      sudo apt install vsftpd
    • Windows: Download and install FileZilla Server.
  2. Configure the server:
    • Configuration file on Linux:
      bash
      sudo nano /etc/vsftpd.conf

      Main settings:

      • Enable anonymous connections (optional): anonymous_enable=YES
      • Enable passive mode: Add the ports to the configuration file.
  3. Start the server:
    • Linux:
      bash
      sudo systemctl start vsftpd
      sudo systemctl enable vsftpd
  4. Open the ports in the firewall (if applicable):
    bash
    sudo ufw allow 21
    sudo ufw allow 40000:50000/tcp

Using FTP

Connecting to the Server

From the command line

  1. Open the terminal.
  2. Connect to the server:
    bash
    ftp <server-address>
  3. Enter your credentials (username and password).

Basic FTP commands

  • ls: Lists the files on the server.
  • cd [directory]: Moves to the given directory.
  • get [file]: Downloads a file from the server.
  • put [file]: Uploads a file to the server.
  • bye or quit: Ends the session.

Using Graphical Clients

  1. Download and install an FTP client, such as FileZilla.
  2. Enter the following details:
    • Server address.
    • Username and password.
    • Port (default: 21).
  3. Connect and transfer files by dragging them between the client and the server.

FTP Security

FTP transfers data in plain text, which can be a security risk. For secure connections, use FTPS (FTP over SSL/TLS) or SFTP (SSH File Transfer Protocol).

Setting up FTPS:

  1. Generate an SSL certificate.
  2. Configure the server to use SSL/TLS (e.g. ssl_enable=YES in vsftpd).

Setting up SFTP:

  1. Use an SSH server (e.g. OpenSSH).
  2. Connect with a compatible client (FileZilla, WinSCP, etc.).

Troubleshooting

Problem: Connection refused

  • Check that the FTP server is running.
  • Make sure the required ports are open in the firewall.

Problem: Permission error

  • Check the file/directory permissions on the server.
  • Adjust the permissions with:
    bash
    chmod 755 [directory]

Conclusion

FTP is a powerful tool for transferring files, but it should be used with security in mind. We recommend secure options such as FTPS or SFTP to protect data in transit.


References

Last updated: November 29, 2026