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:
- An operating system that supports FTP (Linux, Windows, etc.).
- FTP server software (e.g. vsftpd, FileZilla Server, ProFTPD).
Setup steps:
- Install the server:
- Linux (example with vsftpd):
bash
sudo apt update sudo apt install vsftpd - Windows: Download and install FileZilla Server.
- Linux (example with vsftpd):
- Configure the server:
- Configuration file on Linux:
bash
sudo nano /etc/vsftpd.confMain settings:
- Enable anonymous connections (optional):
anonymous_enable=YES - Enable passive mode: Add the ports to the configuration file.
- Enable anonymous connections (optional):
- Configuration file on Linux:
- Start the server:
- Linux:
bash
sudo systemctl start vsftpd sudo systemctl enable vsftpd
- Linux:
- 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
- Open the terminal.
- Connect to the server:
bash
ftp <server-address> - 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
- Download and install an FTP client, such as FileZilla.
- Enter the following details:
- Server address.
- Username and password.
- Port (default: 21).
- 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:
- Generate an SSL certificate.
- Configure the server to use SSL/TLS (e.g.
ssl_enable=YESin vsftpd).
Setting up SFTP:
- Use an SSH server (e.g. OpenSSH).
- 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