Skip to content

Installation

uFTP is installed from source: it builds in a few seconds and has no dependencies except the C library (and OpenSSL if you want TLS).

Requirements

What Needed for Debian / Ubuntu package
git, gcc, make building git gcc make
OpenSSL development files TLS (FTPS), hashed passwords libssl-dev
PAM development files logins with system users (optional) libpam0g-dev
sudo apt-get install git gcc make libssl-dev

Build

git clone https://github.com/kingk85/uFTP.git
cd uFTP
make

The program is build/uFTP. A plain make builds without TLS. Choose the features with options on the make line:

Feature Option
TLS (FTPS) and hashed passwords ENABLE_OPENSSL_SUPPORT="-D OPENSSL_ENABLED" LIBS="-lpthread -lssl -lcrypto"
Logins with system users (PAM) ENABLE_PAM_SUPPORT="-D PAM_SUPPORT_ENABLED" PAM_AUTH_LIB=-lpam
No IPv6 (old systems) ENABLE_IPV6_SUPPORT=
Always use poll() instead of epoll CFLAGSTEMP="-c -Wall -I. -D UFTP_USE_POLL"

For example, TLS and PAM together:

make ENABLE_OPENSSL_SUPPORT="-D OPENSSL_ENABLED" \
     ENABLE_PAM_SUPPORT="-D PAM_SUPPORT_ENABLED" PAM_AUTH_LIB=-lpam \
     LIBS="-lpthread -lssl -lcrypto"

You can also edit the options in the Makefile: uncomment the lines that the comments describe. Large file support (files over 2 GB) is already on.

Note

On Linux the server waits for its connections with epoll; on other systems it uses poll().

Install

Root permissions are required (use sudo on Ubuntu).

sudo cp build/uFTP /sbin/uFTP
sudo cp uftpd.cfg /etc/uftpd.cfg
sudo nano /etc/uftpd.cfg

The server reads ./uftpd.cfg (the directory you start it from) if that file exists, otherwise /etc/uftpd.cfg. Set the owner and keep the file private, because it can contain passwords:

sudo chown root:root /sbin/uFTP /etc/uftpd.cfg
sudo chmod 600 /etc/uftpd.cfg

Then:

  1. Configure the server: at least the users and, for FTPS, the certificate.
  2. Run it: sudo uFTP.

Start at boot (systemd)

uFTP can run in the background by itself (DAEMON_MODE, with a supervisor that restarts it, RESPAWN_PROCESS). With systemd it is cleaner to let systemd do both: set DAEMON_MODE = false and RESPAWN_PROCESS = false in uftpd.cfg, and create /etc/systemd/system/uftp.service:

[Unit]
Description=uFTP server
After=network.target

[Service]
Type=simple
ExecStart=/sbin/uFTP
Restart=on-failure

[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
sudo systemctl enable --now uftp
sudo systemctl status uftp

The logs are written to LOG_FOLDER (one file a day), see Configuration.

Upgrade

Build the new version, stop the server, replace /sbin/uFTP and start it again. Read the release notes first: some defaults change between versions. Keep your uftpd.cfg; new options have defaults and are described in the sample file of the new version.

Other platforms