ssl-guides 2026-12-02 ⏱ 4 min read

Configure SSL/TLS for FTP Servers

Configure SSL/TLS for FTP Servers

To configure SSL for FTP servers you choose between FTPS, which adds TLS to FTP, and SFTP, which runs over SSH. Plain FTP transmits usernames, passwords and file contents in clear text, and those are the two ways to fix it.

SSL for FTP servers: FTPS or SFTP?

FTPSSFTP
Based onFTP plus TLSSSH
Uses TLS certificateYesNo, SSH host keys
Ports21 (explicit) plus passive range, or 990 (implicit)22
Firewall friendlinessHarder, many portsEasy, one port
Client supportWidespreadWidespread

If you control both ends and have no legacy requirement, SFTP is simpler to firewall. Use FTPS when a partner or an old client needs FTP semantics. The rest of this guide covers FTPS with vsftpd.

Step 1: Get a certificate

Use a certificate for the hostname that users connect to, such as ftp.example.com. A free Let's Encrypt certificate is suitable; see getting one with Certbot. Clients verify the name, so connecting by bare IP address will produce warnings.

Step 2: configure vsftpd for SSL on FTP

Edit /etc/vsftpd.conf:

ssl_enable=YES
rsa_cert_file=/etc/ssl/ftp/fullchain.pem
rsa_private_key_file=/etc/ssl/ftp/privkey.pem

force_local_logins_ssl=YES
force_local_data_ssl=YES
allow_anon_ssl=NO

ssl_tlsv1=NO
ssl_tlsv1_1=NO
ssl_tlsv1_2=YES
ssl_sslv2=NO
ssl_sslv3=NO
require_ssl_reuse=NO

The two force_ options stop users sending passwords or data without encryption. Option names and TLS 1.3 support depend on your vsftpd version, so check man vsftpd.conf on your system. require_ssl_reuse=NO is a common setting because some clients do not reuse the TLS session on data connections, but it slightly weakens a protection, so enable reuse if all of your clients support it.

Step 3: Passive mode ports

FTP opens a second connection for data. In passive mode the server picks a port from a range, and your firewall must allow it. Fix the range so you can open it:

pasv_enable=YES
pasv_min_port=40000
pasv_max_port=40100
pasv_address=203.0.113.10

Use your real public IP in pasv_address if the server is behind NAT. Open port 21 and this range in the firewall and cloud security group. A very common symptom of a wrong range is a login that works but directory listings hang.

Step 4: Restart and test

sudo systemctl restart vsftpd

lftp -u user ftp.example.com -e "set ftp:ssl-force true; ls"

openssl s_client -starttls ftp \
  -connect ftp.example.com:21 -servername ftp.example.com

The OpenSSL command checks the certificate and protocol on the control channel. Desktop clients such as FileZilla should show "Explicit FTP over TLS" and prompt on an untrusted certificate; with a valid public certificate there is no prompt. For help reading the output, see testing SSL configuration with OpenSSL.

Step 5: Handle renewals

vsftpd loads the certificate when it starts. After renewal, restart or reload it from a deploy hook; vsftpd does not always pick up changes without a restart, so restart to be safe. Certbot renewal hooks show how. Set a monitoring alert too, as described in setting up SSL expiration alerts.

Hardening notes

  • Use chroot for local users with chroot_local_user=YES and test it with your version.
  • Disable anonymous access unless you really need it.
  • Keep the private key readable only by root, as in how to protect SSL private keys.
  • Consider moving users to SFTP so you can close the passive range.

Troubleshooting

SymptomLikely cause
Login works, listing hangsPassive port range blocked or wrong pasv_address
500 OOPS: SSLCertificate or key path is wrong, or key unreadable
Client warns about certificateConnecting by IP or by a name not in the certificate
Works from some clients onlySession reuse requirement or TLS version mismatch

Check /var/log/vsftpd.log and the system journal for the exact error before changing settings.

If you also run a website on the same host, keep its certificate separate from the FTP one where you can, so a change to one service does not risk the other. Test every change from a client on a different network, not from the server itself.

Related reading: testing SSL configuration with OpenSSL, SSL for PostgreSQL and installing a certificate on Tomcat.

Frequently Asked Questions

Is FTPS the same as SFTP?

No. FTPS adds TLS to FTP and usually runs on port 21 with a passive data range. SFTP is a file transfer protocol that runs inside SSH on port 22 and needs no certificate.

Do I need a paid certificate for FTPS?

No. A free DV certificate works, as long as the hostname clients connect to is in the certificate.

Why do passive mode connections fail after enabling TLS?

The data channel uses a separate port range. Open it in the firewall and pin it in the server config, or clients will connect to a port that is closed.

🔒 Test Your Website SSL Certificate Now
Run Free SSL Check →

✅ Post-Installation Verification & SEO Checklist

After applying the steps above, run through this 5-point checklist to prevent browser warnings and protect your Google SEO rankings:

  • Verify full CA chain trust and TLS 1.3 support using our Live SSL Checker.
  • Scan for Mixed Content HTTP links and check HSTS/CSP headers on Security Headers Checker.
  • Enforce a permanent 301 HTTP-to-HTTPS redirect with our HTTPS Redirect Generator.
  • Confirm both root and www versions resolve cleanly to one canonical HTTPS URL.
  • Verify your HTTPS property and sitemap.xml inside Google Search Console and Bing Webmaster Tools.
Technically Reviewed by TryFreeSSL Security Team
Last updated: 2026-12-05
About Us →

Free SSL Certificates, Live SSL Checker & CSR Generator

Issue trusted Let's Encrypt SSL certificates in 60 seconds with zero server setup.

Related Articles

🤖 TryFreeSSL AI Assistant