For the complete documentation index, see llms.txt. This page is also available as Markdown.

36.2 Pure-FTPd (with MySQL)

Pure-FTPd Does Not Support Chinese Environments

Pure-FTPd has removed support for the FTP protocol internationalization framework defined in RFC 2640. When using FTP command-line tools in Windows to access files with non-English characters, garbled text may appear. For specific changes, refer to the Pure-FTPd 1.0.48 release announcement.

An example of attempting to enable UTF-8 encoding:

ftp> quote opts utf8 on
504 Unknown command

Using command-line tools or clients such as WinSCP on FreeBSD to test Pure-FTPd will not produce garbled text.

Installing Pure-FTPd

Pure-FTPd installed via pkg does not include database support; it must be installed via Ports to enable MySQL integration.

# cd /usr/ports/ftp/pure-ftpd
# make config

During configuration, check MYSQL, keep the remaining options at their default values, and confirm.

Configuring Port pure-ftpd

Configuration Files

Configuration files must first be copied from the sample files, then edited according to actual needs. The configuration file path is: /usr/local/etc/pure-ftpd.conf.

Generating Configuration Files

Copy the sample configuration files to the actual configuration files:

The configuration file structure is as follows:

MySQL Integration Configuration

Edit the /usr/local/etc/pure-ftpd.conf file and adjust the relevant configuration items to enable MySQL authentication:

Configuring MySQL

This section uses MySQL 8.x as an example.

Please refer to other relevant chapters to complete the installation and configuration of MySQL 8.x.

Creating the Database

Create the database and user table for Pure-FTPd:

Creating a Database Login User and Setting a Password

Create a dedicated Pure-FTPd user for connecting to the database:

Test the database connection:

Configuration File

Complete example of the /usr/local/etc/pureftpd-mysql.conf file:

Adding FTP Groups and Users

Warning

After using the database, the pure-pw command will no longer take effect.

Create system users and groups for virtual FTP users to inherit permissions:

When adding FTP login users, you must manually write their information into the MySQL database. The following example creates the user test with the password test2:

Note

The Uid and Gid written into the table must be consistent with the user previously created via pw useradd.

Tip

The design concept is: virtual users in the database inherit the permissions and UID/GID of the user created by pw useradd, and perform FTP file operations using the user information in the database.

Actual operation example:

Configure the FTP directory:

Structure overview:

References

  • osc_e0e3b1a8. Detailed Explanation and Complete Guide to FTP Permission Settings in Linux Environments[EB/OL]. [2026-03-25]. https://my.oschina.net/emacs_8748786/blog/17171107. Detailed explanation of FTP service user permission configuration and directory access control methods.

Service Operations

After configuration is complete, start and manage the Pure-FTPd service:

References

Troubleshooting

  • Pure-FTPd log files are located at /var/log/messages.

Last updated