#Cube: vsftpd
vsftpd 3 with virtual users: no system account per user, one FTP root each, PAM reading a pam_pwdfile file.
In the panel: FTP Manager → Users and Settings. Every write there is a task.
#Configuration
[ftp]config_dir = "/aegis/config/vsftpd"pam_dir = "/etc/pam.d"pam_service = "aegis-vsftpd"guest_user = "aegis-ftp"home_base = "/aegis/data/ftp"passwd_file = "/aegis/config/vsftpd/ftpd.passwd"log_dir = "/aegis/logs/vsftpd"port = 21pasv_min = 40000pasv_max = 40100max_clients = 50max_per_ip = 5ssl_cert = "/aegis/config/vsftpd/ftp.crt"ssl_key = "/aegis/config/vsftpd/ftp.key"| Key | Default | Meaning |
|---|---|---|
config_dir | /aegis/config/vsftpd | vsftpd.conf, password file, empty/ |
pam_dir | /etc/pam.d | where the PAM service is written |
pam_service | aegis-vsftpd | PAM service name vsftpd calls |
guest_user | aegis-ftp | system account every virtual user maps to |
home_base | /aegis/data/ftp | one directory per virtual user |
passwd_file | <config_dir>/ftpd.passwd | user:hash lines read by pam_pwdfile |
log_dir | /aegis/logs/vsftpd | transfer log and keeper log |
port | 21 | control connection |
pasv_min, pasv_max | 40000, 40100 | passive data ports; open them in the firewall |
max_clients | 50 | simultaneous connections |
max_per_ip | 5 | connections per source address |
ssl_cert, ssl_key | <config_dir>/ftp.* | local certificate copied there by configure |
#Files
<ftp.config_dir>/├── vsftpd.conf daemon configuration├── ftpd.passwd user:hash lines, mode 0640├── empty/ secure_chroot_dir, mode 0555├── ftp.crt / ftp.key TLS material used by the daemon└── vsftpd.pid written by the keeper<ftp.home_base>/└── <user>/ one FTP root per user<ftp.log_dir>/└── vsftpd.log transfer log/etc/pam.d/aegis-vsftpd PAM service (``ftp.pam_service``)#Commands
aegis cubes vsftpd configure # account, TLS, configuration, startaegis cubes vsftpd validate # files present, binary runsaegis cubes vsftpd reload # restart: configuration is read at startupaegis cubes vsftpd start|stop|restart|statusaegis cubes vsftpd users listaegis cubes vsftpd users add demo --password 'secret123'aegis cubes vsftpd users password demo --password 'new-secret'aegis cubes vsftpd users remove demoaegis cubes vsftpd expose#Virtual users
users add:
[a-z0-9._-], 32 characters at most);openssl passwd -6 — pam_pwdfile accepts crypt(3)hashes, and SHA512 is what the build supports everywhere;
user:hash to the password file;<home_base>/<user> and hands it to the guest account.users remove drops the line and leaves the files on disk.
#How a login works
client → vsftpd → PAM (aegis-vsftpd) → pam_pwdfile → ftpd.passwd ↓ guest_enable maps the user onto <ftp.guest_user> ↓ local_root = <home_base>/<user>, chrootedTwo details that are easy to get wrong:
local_enable=YES is required even with guest_enable=YES: without itvsftpd answers 500 OOPS: both local and anonymous access disabled! at the banner.
applies local_root; a missing home is 500 OOPS: cannot change directory.
#PAM module
The built module lives in the application prefix, but PAM only searches the system module directory. The generated service therefore references it by absolute path:
auth required /aegis/apps/ftp/pam-pwdfile/2.0/lib/security/pam_pwdfile.so pwdfile=/aegis/config/vsftpd/ftpd.passwd#Build
The distribution tarball ships with #undef VSF_BUILD_SSL, so the profile applies two patches:
| Patch | Why |
|---|---|
capabilities.patch | the link helper never looks in the multiarch libcap directory |
ssl.patch | defines VSF_BUILD_SSL; without it ssl_enable=YES exits with status 2 |
ssl-deprecated.patch | #define OPENSSL_SUPPRESS_DEPRECATED in ssl.c, because the Makefile compiles with -Werror |
ssl-declaration.patch | fixes the setup_bio_callbacks() prototype: C23 (GCC 15) treats f() as f(void) and -Werror rejects the mismatch |
The Makefile assigns CFLAGS, IFLAGS and LDFLAGS itself, so the vendored OpenSSL paths are passed on the command line ([make] args) and the binary ends up with a RUNPATH into /aegis/apps/libs/openssl/3.5/lib.
#expose
aegis cubes vsftpd exposecube vsftpdinstalled /aegis/apps/ftp/vsftpd/3.0configuration /aegis/config/vsftpdstate running pid 894xxxconfig /aegis/config/vsftpd/vsftpd.confpam /etc/pam.d/aegis-vsftpdusers 1home /aegis/data/ftptls /aegis/config/vsftpd/ftp.crt#Notes
write_enable=YES is set: vsftpd defaults to read-only.40000-40100 must be open in the firewall for clients behindNAT.
configure; it reads its configuration onlyonce, at startup.