A small FTP and FTPS server that does not get in your way.
uFTP is an open source FTP server written in C for Linux and POSIX systems. One binary, one configuration file, TLS included, MIT license.
What you get
Everything a file transfer server needs, and nothing that makes it hard to run.
FTP and FTPS
Explicit TLS (AUTH TLS) for the control and data connections, passive and active mode, IPv4 and IPv6.
One binary, one file
Copy the program and uftpd.cfg, edit the file, run it. It can be compiled statically.
Works with your clients
Tested with FileZilla, Cyberduck, lftp and Python's ftplib. Directory listings with MLSD.
Safer by default
Hashed passwords, per-address and per-account limits, login lock-out, a ready fail2ban filter, and a SECURITY.md to report problems in private.
Many connections
One process with a few threads, not one process per client. A slot costs a few kilobytes of memory.
Tested
An automatic suite of about 460 tests, fuzzing, and builds with AddressSanitizer and ThreadSanitizer.
Performance
Measured numbers, with the conditions they were measured in.
sendfile(), 0.08 s of CPU per GBMeasured on a 12-core machine with the clients and the server on the same host, so a real network will give different results. The method and the full results are in the repository (test/benchmark).
Install from source
The recommended way. It takes a couple of minutes.
# Get the code and build it
git clone https://github.com/kingk85/uFTP.git
cd uFTP
# For TLS support, edit the Makefile and uncomment these two lines:
# ENABLE_OPENSSL_SUPPORT=-D OPENSSL_ENABLED
# LIBS=-lpthread -lssl -lcrypto
# For PAM logins (system users), uncomment the two PAM lines as well.
make
# Install the program and the configuration (root is required)
sudo cp build/uFTP /sbin/uFTP
sudo cp uftpd.cfg /etc/uftpd.cfg
sudo nano /etc/uftpd.cfg
# Only root may read the configuration
sudo chown root:root /sbin/uFTP /etc/uftpd.cfg
sudo chmod 600 /etc/uftpd.cfg
# Run it (root permissions are required)
sudo uFTP
The configuration file explains every option. More pages in the documentation: installation, configuration, NAT and passive ports, Raspberry Pi, running without root.
Set up a TLS certificate
Build uFTP with OpenSSL (see above), create a certificate, and tell the server where it is. This makes a self-signed certificate; clients ask you to trust it the first time.
# 1. Create the certificate and the private key (replace the name with your host name)
sudo mkdir -p /etc/uFTP
sudo openssl req -x509 -newkey rsa:4096 -nodes -days 825 \
-keyout /etc/uFTP/key.pem -out /etc/uFTP/cert.pem \
-subj "/CN=ftp.example.com" -addext "subjectAltName=DNS:ftp.example.com"
# 2. Only root may read the private key
sudo chown root:root /etc/uFTP/key.pem /etc/uFTP/cert.pem
sudo chmod 600 /etc/uFTP/key.pem
# 3. In /etc/uftpd.cfg
CERTIFICATE_PATH=/etc/uFTP/cert.pem
PRIVATE_CERTIFICATE_PATH=/etc/uFTP/key.pem
FORCE_TLS=true # optional: refuse connections without TLS
# 4. Start uFTP and check it
sudo uFTP
openssl s_client -starttls ftp -connect ftp.example.com:21
In your FTP client choose "FTP over explicit TLS" (FileZilla: Require explicit FTP over TLS). The last command should print the certificate and TLSv1.3.
Guides
Step by step, for the things people ask most.
Install an FTP server on Linux
Build uFTP, create a user and connect with FileZilla in five minutes.
FTPS with a certificate
Self-signed or Let's Encrypt certificates, certificate chains, and how to renew them.
FTP server on a Raspberry Pi
A light server for a small board, started at boot.
FTP behind a NAT or firewall
Passive ports, the public address and FTPS.
Run an FTP server without root
For embedded devices and tight permissions.
Troubleshooting
Connection, passive mode, certificate and error code problems.
Questions
Is uFTP free?
Yes. It is open source under the MIT license: free for personal and commercial use.
Does uFTP support FTPS?
Yes: explicit FTPS (AUTH TLS) with TLS 1.2 and 1.3, on the control and the data connections. Implicit FTPS on port 990 is not supported.
Does it run on a Raspberry Pi?
Yes. It is written in C, builds on the board in seconds and needs only OpenSSL for TLS.
How do I use a Let's Encrypt certificate?
Point CERTIFICATE_PATH to fullchain.pem and PRIVATE_CERTIFICATE_PATH to privkey.pem, and restart uFTP after every renewal. Details.
Open source
The MIT license lets you use uFTP and reuse its code, even in commercial products. Bug reports, ideas and pull requests are welcome on GitHub. To report a security problem in private, read SECURITY.md.