How to encrypt files and backups
Updated 7/20/2026
Backups often contain sensitive data. If you store them off the server, encryption makes them useless to anyone without the password.
Encrypt a file with GPG
gpg -c backup.tar.gz
You get backup.tar.gz.gpg, protected with a password. Decrypt:
gpg backup.tar.gz.gpg
Encrypt during the backup
mysqldump -u root -p app_db | gzip | gpg -c > app_db.sql.gz.gpg
The data is encrypted before it touches the disk, useful when sending a backup to a Backup Box.
Key-based encryption (no interactive password)
For automated scripts, use a GPG public key instead of a password:
gpg --encrypt --recipient [email protected] backup.tar.gz
Important rules
- Keep the password or private key separate from the backups; without it, the data is lost permanently.
- Test decryption periodically, a backup that cannot be decrypted is worthless.
- Combine with automated backups with cron.
Put this guide into practice on your own VPS
EU cloud servers, billed hourly, ready in minutes, with one-click installs for dozens of apps.
See pricingRelated tutorials
Storage & files
How to sync files automatically with Syncthing
Syncthing syncs files in real time between servers and devices, encrypted and without an external cloud.
Updated 7/20/2026Storage & filesHow to manage disk space and partitions
See how your disks are organized, mount a new disk and expand space when you need it.
Updated 7/20/2026Storage & filesHow to share files through a web interface with File Browser
File Browser gives you a simple web interface to manage and share files on your server.
Updated 7/20/2026