We may earn a referral fee at no additional cost to you when you shop through the links on this page.
vsftpd (Very Secure FTP Daemon) is a fast, stable FTP server for Linux, but the default /etc/vsftpd.conf ships cluttered with commented-out options, so it is hard to see what is actually running. This DevAnswers guide gives two clean, comment-free configurations you can drop in: a standard local-user setup and a secure FTPS (TLS) setup. Both are tested, and we cover the gotchas that stop vsftpd from starting. For failures beyond those, the vsftpd log is the place to look next.
Standard vsftpd.conf (Local Users)
The steps below use Debian/Ubuntu paths and commands; RHEL, Rocky, and AlmaLinux are covered in their own section near the end (the vsftpd.conf directives are the same on all of them). Install vsftpd, then open the config file:
sudo apt install vsftpd
sudo nano /etc/vsftpd.conf
Replace its contents with this standard configuration for authenticated local users, then save and exit:
listen=YES
listen_ipv6=NO
anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=022
dirmessage_enable=YES
use_localtime=YES
xferlog_enable=YES
connect_from_port_20=YES
chroot_local_user=YES
allow_writeable_chroot=YES
secure_chroot_dir=/var/run/vsftpd/empty
pam_service_name=vsftpd
pasv_enable=YES
pasv_min_port=40000
pasv_max_port=40100
Save and exit (press CTRL + X, press Y, then press ENTER)
The key directives: anonymous_enable=NO blocks anonymous logins, while local_enable=YES allows your system user accounts (from /etc/passwd) to log in, which is required for any non-anonymous login. write_enable=YES permits uploads and other write commands. chroot_local_user=YES locks each user into their home directory after login so they cannot browse the wider filesystem, and listen=YES runs vsftpd as a standalone daemon. The pasv_min_port/pasv_max_port range is for passive mode, covered below.
This config authenticates against your existing system users, so create one for FTP if you have not already. Give it a real login shell, because vsftpd checks the user has a valid shell by default:
sudo adduser billy
Then apply the config by restarting the service:
sudo systemctl restart vsftpd
Secure vsftpd.conf With TLS (FTPS)
Plain FTP sends credentials and data in cleartext. To encrypt the connection you want FTPS (FTP over TLS), which is what vsftpd provides. Note that FTPS is not the same as SFTP: SFTP is a different protocol that runs over SSH and has nothing to do with vsftpd. To enable FTPS, first generate a self-signed certificate (or use one from your CA):
sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 \
-keyout /etc/ssl/private/vsftpd.pem \
-out /etc/ssl/private/vsftpd.pem
Then add the TLS directives to your vsftpd.conf (on top of the standard settings above). Open the file again:
sudo nano /etc/vsftpd.conf
Append these lines, then save and exit:
ssl_enable=YES
rsa_cert_file=/etc/ssl/private/vsftpd.pem
rsa_private_key_file=/etc/ssl/private/vsftpd.pem
force_local_data_ssl=YES
force_local_logins_ssl=YES
ssl_tlsv1=NO
ssl_tlsv1_1=NO
ssl_tlsv1_2=YES
ssl_sslv2=NO
ssl_sslv3=NO
require_ssl_reuse=NO
ssl_ciphers=HIGH
Save and exit (press CTRL + X, press Y, then press ENTER)
Here ssl_enable=YES turns on TLS, and rsa_cert_file and rsa_private_key_file point to your certificate and private key (the same file here, since the self-signed pair is combined). force_local_data_ssl=YES and force_local_logins_ssl=YES require local users to use an encrypted connection for both the login and file transfers. The protocol lines disable everything below TLS 1.2: ssl_sslv2=NO and ssl_sslv3=NO turn off the old SSL versions, and ssl_tlsv1=NO with ssl_tlsv1_1=NO drop the obsolete TLS 1.0 and 1.1 so only ssl_tlsv1_2=YES (TLS 1.2+) is offered. Restart vsftpd and connect with an FTPS-capable client (set the client to “Require explicit FTP over TLS”). You can confirm the server offers TLS with our guide to testing a server for TLS support.
Common Gotchas
Writable chroot. If you enable chroot_local_user=YES together with write_enable=YES, vsftpd by default refuses to start a session with the error 500 OOPS: vsftpd: refusing to run with writable root inside chroot(). The quick fix is allow_writeable_chroot=YES (included above), but note this is potentially dangerous: a user who can write to their chroot root could place files that affect how programs run inside it.
/home/billy and have them upload into /home/billy/files). Reserve allow_writeable_chroot=YES for trusted users or low-risk servers. Passive ports and the firewall. Modern FTP clients use passive mode, where the server opens a data port for the client to connect to. pasv_min_port and pasv_max_port constrain those data connections to a known range (40000-40100 above), so you can open just that range in your firewall instead of a wide span. That range gives you roughly 100 ports, enough for about 100 simultaneous transfers. If you use a firewall, allow port 21 and the passive range:
sudo ufw allow 21/tcp
sudo ufw allow 40000:40100/tcp
On RHEL, Rocky, and AlmaLinux
vsftpd runs on Red Hat based systems with the same vsftpd.conf directives shown above; only the surrounding paths and commands differ. Install it with dnf:
sudo dnf install vsftpd
The config file lives at /etc/vsftpd/vsftpd.conf (in a subdirectory, unlike Debian/Ubuntu). Use the same directives, with two path changes: set secure_chroot_dir=/usr/share/empty (which exists by default on RHEL) instead of /var/run/vsftpd/empty, and for TLS put the certificate under /etc/pki/tls/private/:
sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 \
-keyout /etc/pki/tls/private/vsftpd.pem \
-out /etc/pki/tls/private/vsftpd.pem
Point rsa_cert_file and rsa_private_key_file at that path. Create the FTP user with useradd (it does not set a password, so follow with passwd):
sudo useradd -m -s /bin/bash billy
sudo passwd billy
RHEL uses firewalld rather than ufw, so open the ports with firewall-cmd:
sudo firewall-cmd --permanent --add-port=21/tcp
sudo firewall-cmd --permanent --add-port=40000-40100/tcp
sudo firewall-cmd --reload
sudo setsebool -P ftpd_full_access on, then restart vsftpd with sudo systemctl restart vsftpd. Verify the Server Works
After restarting, confirm vsftpd is running and listening on port 21:
sudo systemctl status vsftpd
sudo ss -tlnp | grep :21
Then test an actual login. From another machine (or locally), connect as one of your local users and upload a file. If the login is refused, check that the user has a valid login shell and see our guide on the vsftpd 550 Permission Denied error; if you cannot find the running config, see where vsftpd.conf lives. If your uploads have incorrect permissions, you can fix vsftpd uploaded file permissions by modifying the umask.
Summary
Drop in the standard vsftpd.conf for authenticated local-user FTP, or the TLS version for encrypted FTPS. Remember the two things that trip people up: set allow_writeable_chroot=YES (or use a non-writable chroot with a writable subdirectory) when combining chroot_local_user with write_enable, and constrain pasv_min_port/pasv_max_port so your firewall stays tight. On RHEL/Rocky/AlmaLinux the directives are the same, with different paths (/etc/vsftpd/vsftpd.conf, /etc/pki/tls/private/), firewalld instead of ufw, and the SELinux ftpd_full_access boolean. Restart vsftpd and test a real login to confirm.
Thanks SO much!
Oh, sorry for the last comment, this post helped me a lot 🙂
🙂