Set Up Pure-FTPd with TLS and Virtual Users on Debian 13
Install Pure-FTPd on Debian 13 with virtual users, chroot, a fixed passive port range and mandatory TLS, using Debian's one-file-per-option configuration.
This guide installs Pure-FTPd on Debian 13 (trixie) with virtual users kept in Pure-FTPd's own database, every user locked into their home directory, and TLS required for all sessions. The same steps work on Debian 12, which uses the same package layout. Debian 9, which older tutorials targeted, is end-of-life and should not be used for a new FTP server.
Debian 13 ships Pure-FTPd 1.0.50. Run the commands as a user with sudo rights.
Install Pure-FTPd
sudo apt update
sudo apt install pure-ftpd
This pulls in pure-ftpd-common, which contains the Debian wrapper and the configuration directory. Variants with MySQL, PostgreSQL or LDAP authentication exist as pure-ftpd-mysql, pure-ftpd-postgresql and pure-ftpd-ldap; you do not need them for the setup described here.
How the Debian configuration works
Debian does not use a single pure-ftpd.conf. A wrapper script, pure-ftpd-wrapper, builds the daemon's command line from two directories:
/etc/pure-ftpd/conf/— one file per option. The file name is the option name and the file holds a single line with its value. Boolean options acceptyesorno./etc/pure-ftpd/auth/— symbolic links that enable authentication methods. They are tried in alphabetical order, which is why the link names start with a number.
To see every option name the wrapper understands, run:
sudo pure-ftpd-wrapper --show-options
Configure virtual users and chroot
Enable the PureDB user database and turn off PAM and system-account logins, so that only virtual users can connect:
echo /etc/pure-ftpd/pureftpd.pdb | sudo tee /etc/pure-ftpd/conf/PureDB
sudo ln -s ../conf/PureDB /etc/pure-ftpd/auth/50pure
echo no | sudo tee /etc/pure-ftpd/conf/PAMAuthentication
echo no | sudo tee /etc/pure-ftpd/conf/UnixAuthentication
If the link already exists, ln reports it and you can continue. Next, refuse anonymous logins, confine every user to their home directory, and let Pure-FTPd create a missing home directory at first login:
echo yes | sudo tee /etc/pure-ftpd/conf/NoAnonymous
echo yes | sudo tee /etc/pure-ftpd/conf/ChrootEveryone
echo yes | sudo tee /etc/pure-ftpd/conf/CreateHomeDir
Set a passive port range
FTP opens a separate data connection for every listing and transfer. Fix the port range so you can open it in your firewall. The file takes two numbers separated by a space:
echo "30000 30100" | sudo tee /etc/pure-ftpd/conf/PassivePortRange
If the server sits behind NAT and has a private address on its interface, also tell Pure-FTPd which public address to announce:
echo 203.0.113.10 | sudo tee /etc/pure-ftpd/conf/ForcePassiveIP
Enable TLS
Pure-FTPd reads its certificate and private key from one combined file, /etc/ssl/private/pure-ftpd.pem. For a quick start, create a self-signed certificate:
sudo openssl req -x509 -nodes -newkey rsa:2048 -sha256 -days 365 \
-subj "/CN=ftp.example.com" \
-keyout /etc/ssl/private/pure-ftpd.pem \
-out /etc/ssl/private/pure-ftpd.pem
sudo chmod 600 /etc/ssl/private/pure-ftpd.pem
Clients will show a warning for a self-signed certificate. If you already have a Let's Encrypt certificate for the host name, build the combined file from it instead, and repeat this (followed by a restart) after every renewal, for example from a Certbot deploy hook:
sudo sh -c 'cat /etc/letsencrypt/live/ftp.example.com/privkey.pem /etc/letsencrypt/live/ftp.example.com/fullchain.pem > /etc/ssl/private/pure-ftpd.pem'
sudo chmod 600 /etc/ssl/private/pure-ftpd.pem
Now set the TLS mode:
echo 2 | sudo tee /etc/pure-ftpd/conf/TLS
| Value | Behaviour |
|---|---|
0 | TLS disabled (the default) |
1 | Clients may connect with or without TLS |
2 | Cleartext sessions are refused; only TLS clients are accepted |
3 | As 2, and unencrypted data connections are refused as well |
Create the system account and FTP users
Virtual users exist only in Pure-FTPd's database, but files on disk still need an owner. Create one unprivileged system account that all virtual users map to, and a directory to hold their homes:
sudo groupadd ftpgroup
sudo useradd -g ftpgroup -d /dev/null -s /usr/sbin/nologin ftpuser
sudo mkdir -p /srv/ftp
sudo chown ftpuser:ftpgroup /srv/ftp
Add a virtual user. You are asked for the password twice. The -d option sets the home directory and chroots the user into it, and -m rebuilds the database so the change takes effect immediately:
sudo pure-pw useradd deploy -u ftpuser -g ftpgroup -d /srv/ftp/deploy -m
On Debian, pure-pw stores accounts in /etc/pure-ftpd/pureftpd.passwd and compiles them into /etc/pure-ftpd/pureftpd.pdb, the file you referenced in conf/PureDB. Other useful commands:
sudo pure-pw list
sudo pure-pw show deploy
sudo pure-pw passwd deploy -m
sudo pure-pw userdel deploy -m
If you leave out -m, run sudo pure-pw mkdb afterwards to commit the change.
Restart and open the firewall
sudo systemctl restart pure-ftpd
sudo systemctl status pure-ftpd
Allow the control port and the passive range. With ufw:
sudo ufw allow 21/tcp
sudo ufw allow 30000:30100/tcp
If your provider has a network firewall in your hosting control panel, open the same ports there.
Verify the setup
Check that the daemon is listening and that the options you set are on its command line:
sudo ss -tlnp | grep ':21 '
ps -o args= -C pure-ftpd
Test the TLS handshake on the control connection from any machine with OpenSSL:
openssl s_client -connect 203.0.113.10:21 -starttls ftp
You should see the certificate followed by an FTP greeting. Then connect with an FTP client such as FileZilla or lftp, choosing "explicit FTP over TLS" on port 21, and log in as deploy. The user should land in an empty directory shown as / and be unable to move above it.
Troubleshooting
- Login fails for a new user: the database was not rebuilt. Run
sudo pure-pw mkdb, and confirm that/etc/pure-ftpd/auth/50purepoints to../conf/PureDB. - Login works but directory listings hang: the passive ports are blocked, or the server announces a private address. Check the firewall range and
ForcePassiveIP. - The service does not start after enabling TLS: the file
/etc/ssl/private/pure-ftpd.pemis missing or does not contain both the key and the certificate. - Log messages: Pure-FTPd logs through syslog, so read them with
sudo journalctl -t pure-ftpd.
Frequently asked questions
Is this FTPS the same thing as SFTP?
No. What you configured here is FTP with TLS (often called FTPS or FTPES) on port 21 plus the passive ports. SFTP is a different protocol that runs over SSH on port 22 and is provided by OpenSSH, not by Pure-FTPd. If your users only need file transfer and already have SSH accounts, SFTP needs no extra software.
Should I use TLS mode 2 or 3?
Mode 2 forces the login and commands to be encrypted, and well-behaved clients encrypt the data channel too. Mode 3 additionally refuses any unencrypted data connection. Pure-FTPd's documentation calls 3 an extreme setting because some clients cannot cope with it; start with 2 and move to 3 once you know your clients work.
Can several virtual users share one directory?
Yes. Give them the same -d path when you create them. Because all virtual users map to the ftpuser system account, they can read and change each other's files there.
How do I limit a user's disk space or speed?
pure-pw useradd and pure-pw usermod accept per-user quota and bandwidth options. Run pure-pw without arguments or read man pure-pw for the list, and remember to add -m so the change is written to the database.