Skip to content

FTP / FTPS (File Transfer Protocol) โ€‹

Store backups on any FTP server with optional TLS encryption.

Overview โ€‹

FTP is one of the most widely supported file transfer protocols. With FTPS (FTP over TLS), transfers are encrypted. Benefits:

  • ๐ŸŒ Universally supported by hosting providers
  • ๐Ÿ”’ Optional TLS encryption (FTPS)
  • ๐Ÿ“ Simple file management
  • โšก No CLI dependencies required

Prefer FTPS

Plain FTP transfers data (including credentials) unencrypted. Always enable TLS when possible.

Configuration โ€‹

FieldDescriptionDefault
NameFriendly nameRequired
HostFTP server hostname or IPRequired
PortFTP port21
UsernameFTP usernameanonymous
PasswordFTP passwordOptional
EncryptionEnable TLS (FTPS)Off
Path PrefixRemote directoryOptional

Encryption (TLS) โ€‹

When TLS is enabled, DBackup uses Explicit FTPS (AUTH TLS):

  1. Connects on the standard FTP port (21)
  2. Upgrades the connection to TLS before sending credentials
  3. All data is encrypted from that point on

This is the modern, recommended way to secure FTP connections.

TIP

If your server uses port 990 with Implicit FTPS (TLS from the start), this is a legacy protocol. Most modern FTP servers support Explicit FTPS on port 21.

Server Setup โ€‹

vsftpd (Linux) โ€‹

bash
# Install
sudo apt install vsftpd

# Create backup user
sudo useradd -m -d /home/ftpbackup -s /usr/sbin/nologin ftpbackup
sudo passwd ftpbackup
sudo mkdir -p /home/ftpbackup/backups
sudo chown ftpbackup:ftpbackup /home/ftpbackup/backups

# Enable TLS in /etc/vsftpd.conf
ssl_enable=YES
allow_anon_ssl=NO
force_local_data_ssl=YES
force_local_logins_ssl=YES
rsa_cert_file=/etc/ssl/certs/vsftpd.pem
rsa_private_key_file=/etc/ssl/private/vsftpd.key

sudo systemctl restart vsftpd

ProFTPD (Linux) โ€‹

bash
# Install
sudo apt install proftpd proftpd-mod-tls

# Configure TLS in /etc/proftpd/tls.conf
<IfModule mod_tls.c>
  TLSEngine on
  TLSLog /var/log/proftpd/tls.log
  TLSProtocol TLSv1.2 TLSv1.3
  TLSRSACertificateFile /etc/ssl/certs/proftpd.pem
  TLSRSACertificateKeyFile /etc/ssl/private/proftpd.key
</IfModule>

sudo systemctl restart proftpd

Docker (Quick Test) โ€‹

yaml
services:
  ftp:
    image: fauria/vsftpd
    environment:
      - FTP_USER=backup
      - FTP_PASS=secret
      - PASV_ADDRESS=127.0.0.1
    ports:
      - "21:21"
      - "21100-21110:21100-21110"
    volumes:
      - ./ftp-data:/home/vsftpd

Directory Structure โ€‹

After backups, your FTP server will have:

/backups/
โ”œโ”€โ”€ mysql-daily/
โ”‚   โ”œโ”€โ”€ backup_2024-01-15T12-00-00.sql.gz
โ”‚   โ”œโ”€โ”€ backup_2024-01-15T12-00-00.sql.gz.meta.json
โ”‚   โ””โ”€โ”€ ...
โ””โ”€โ”€ postgres-weekly/
    โ””โ”€โ”€ ...

Troubleshooting โ€‹

Connection Refused โ€‹

connect ECONNREFUSED

Solutions:

  1. Verify FTP server is running
  2. Check firewall allows port 21
  3. Verify hostname/IP is correct

TLS Handshake Failed โ€‹

SSL routines:tls_validate_record_header:wrong version

Solutions:

  1. Verify the server actually supports TLS
  2. If using plain FTP, disable the TLS toggle
  3. Check server TLS configuration

Login Failed โ€‹

Login authentication failed

Solutions:

  1. Verify username and password
  2. Check user has FTP access on the server
  3. Verify user is not locked or disabled

Passive Mode Issues โ€‹

Connection timed out (data channel)

Solutions:

  1. Check firewall allows passive ports (typically 21100-21110)
  2. Verify PASV_ADDRESS is set correctly on the server
  3. If behind NAT, ensure passive port range is forwarded

Permission Denied โ€‹

Permission denied

Solutions:

  1. Check user owns the backup directory
  2. Verify write permissions on the server
  3. Check FTP server chroot configuration

Performance โ€‹

Optimize for Large Backups โ€‹

  1. Enable compression in DBackup to reduce transfer size
  2. Use local network โ€” avoid transferring over the internet if possible
  3. Check passive mode โ€” misconfigured passive mode can cause slow transfers

Network Considerations โ€‹

  • FTP uses separate control/data channels
  • Passive mode requires additional port range
  • Consider using SFTP instead for simpler firewall setup

Security Best Practices โ€‹

  1. Always enable TLS โ€” never use plain FTP for sensitive data
  2. Use strong passwords โ€” FTP lacks key-based auth
  3. Restrict user access โ€” chroot users to their home directory
  4. Firewall rules โ€” limit source IPs
  5. Disable anonymous access in production
  6. Use SFTP instead if SSH access is available (more secure)

Comparison with Other Destinations โ€‹

FeatureFTP/FTPSSFTPS3Local
Setup complexityEasyMediumEasyEasiest
EncryptionOptional (TLS)Always (SSH)Always (HTTPS)N/A
Auth methodsPassword onlyPassword, Key, AgentAccess KeyN/A
Firewall complexityHigh (passive ports)Low (single port)Low (HTTPS)N/A
Widely supportedโœ…โœ…โœ…โœ…

Next Steps โ€‹

Released under the GNU General Public License. | Privacy ยท Legal Notice