keepcalculator

06 Numbers and Powers

Restic Backup Security: Passwords & Restore Checks

Card No. 06·67996 · Updated · Standard formula, shown below

Restic backup security protects your data with strong encryption and integrity checks, and it does verify restores through a built-in check command, though the depth of verification depends on how you use it. You protect your backups with a password that encrypts your data, and you can verify restores by running restic check and performing test restores. This article explains how restic’s security model works, how to manage your password safely, and how to confirm your backups are actually restorable.

Background: What Restic Is and Why Security Matters

Restic is a free, open-source backup program that stores encrypted snapshots of your files in a repository, which can be a local directory, an SFTP server, or cloud storage like AWS S3, Backblaze B2, or Azure. Unlike simple file copy tools, restic uses content-defined chunking and deduplication to save only changed parts of files, which makes backups faster and more storage-efficient. Because backups often contain sensitive personal or business data, restic was designed with a strong security model from the start: all data is encrypted client-side before it leaves your machine, and the repository is protected by a password that you choose. This means that even if someone steals your backup storage, they cannot read your files without that password.

How Restic Encrypts Your Data and Protects It

Restic uses AES-256 in counter mode for encryption and Poly1305-AES for authentication, which is a modern, widely accepted cryptographic construction. When you initialize a repository with restic init, it generates a random master key that is used to encrypt all data. That master key itself is encrypted with a key derived from your password using the scrypt key derivation function, which is deliberately slow and memory-hard to resist brute-force attacks. This means your password is never stored directly—only a salted hash is used to unlock the master key. Even if an attacker obtains the repository files, they would need to guess your password to decrypt the master key, and then use that key to decrypt the data. The encryption is transparent: you enter your password when running restic commands, and it decrypts only the necessary parts of the repository.

How to Choose a Strong Password and Store It Safely

Your restic password is the single most important factor in backup security. If you lose it, you lose access to all your backups—there is no backdoor. Choose a long, random passphrase, not a short password. For example, a passphrase like correct horse battery staple is far stronger than P@ssw0rd! because length and randomness matter more than complexity rules. Use a password manager to generate and store it, or write it down and keep it in a secure place. Never reuse a password from another service, and do not share it via email or chat. If you forget your password, there is no recovery option, so consider storing a copy in a safe deposit box or with a trusted person.

Verifying Restores: The Built-in Check and Test Restores

Restic provides restic check to verify the integrity of your repository. This command reads all data and checks that the encryption and authentication tags are valid, that the pack files are not corrupted, and that the index is consistent. It does not, however, restore your files to disk—it only verifies the internal structure. To truly verify that you can restore your data, you should perform a test restore: restore a snapshot to a temporary directory and compare the files with the original. You can do this with restic restore latest --target /tmp/restore-test and then use a diff tool like diff -r to compare. For an automated approach, you can script a nightly test restore to a scratch location and delete it afterward. Many users also run restic check --read-data which reads all pack data, not just metadata, to catch silent corruption. The official documentation recommends regular test restores as part of a backup strategy.

Common Problems and Misconceptions

  • Forgetting the password: This is the most common issue. There is no recovery, so always keep a backup of your password in a secure location.
  • Confusing encryption with integrity: Encryption protects confidentiality, but it does not prevent data corruption. You still need restic check and test restores to ensure data is readable.
  • Assuming cloud storage is safe: Even if your cloud provider is compromised, encryption protects your data, but you must also ensure your password is not stored in the same place as your backups (e.g., in a text file on the same server).
  • Not verifying restores regularly: A backup that has never been tested is not a backup. Schedule test restores periodically, especially after changing your backup configuration.
  • Using a weak password: Short passwords are vulnerable to brute-force attacks. Use a passphrase of at least 20 characters.

Comparing Restic to Other Backup Tools

Restic is often compared to BorgBackup, Duplicati, and restic’s own predecessor, Attic. Borg also uses encryption and deduplication, but it uses a different cryptographic design (AES-256-CTR with HMAC-SHA256) and requires the repository to be on a filesystem that supports certain features. Duplicati uses AES-256 and supports many cloud providers, but it has had security issues in the past. Restic’s key advantage is its simplicity and cross-platform support—it runs on Linux, macOS, and Windows, and it works with a wide range of backends. Unlike Borg, restic does not require a specific server setup; it can use SFTP, S3, or local disks directly. For security, both restic and Borg are solid, but restic’s use of scrypt and its simpler key management make it a popular choice for users who want a straightforward, secure backup tool.

Costs and Practical Considerations

Restic itself is free and open-source, but you will pay for storage if you use cloud backends. Costs vary by provider, but you can estimate based on your data size and retention policy. For example, if you have 100 GB of data and keep 30 daily snapshots, the storage usage will be roughly 100 GB plus the changes each day, so you might pay for 150 GB. You can reduce costs by using restic’s retention policies (--keep-daily, --keep-weekly, etc.) to prune old snapshots. There is also a small overhead for the repository metadata, typically a few percent of your data size. When comparing costs, factor in the price of storage, network egress fees, and any minimum storage durations. Restic does not have any licensing fees, so the main cost is your storage provider.

Safety Tips and Best Practices

  • Always initialize your repository with restic init and note the password in a secure place.
  • Use restic backup with the --exclude-file option to avoid backing up temporary or unnecessary files.
  • Set up a retention policy to avoid accumulating too many snapshots, which can slow down operations and increase costs.
  • Run restic check after every backup or at least weekly to detect corruption early.
  • Perform a test restore monthly, or after any major system change, to confirm your backups are restorable.
  • Consider using restic prune to remove unreferenced data and keep the repository compact.
  • Store your password in a password manager and enable two-factor authentication on your cloud storage account if available.

Frequently Asked Questions

What happens if I lose my restic password?

If you lose your restic password, you cannot decrypt your backups. There is no built-in recovery mechanism. You would need to start a new repository and create new backups. To avoid this, store a copy of your password in a secure offline location, such as a safe or a password manager with a printed backup.

Does restic check actually restore files?

No, restic check only verifies the integrity of the repository structure and the encryption tags. It does not restore files to your disk. To verify that you can restore, you must run a test restore and compare the files with the original.

Can I use the same password for multiple repositories?

Technically yes, but it is not recommended. If one repository is compromised, an attacker could try the same password on others. Use a unique password for each repository, or at least for repositories that contain different levels of sensitive data.

Is it safe to store my restic password in a plain text file?

No, storing your password in plain text on your computer or in the cloud is risky. If your machine or cloud account is compromised, the attacker can read the password and decrypt your backups. Use a password manager or a secure note with encryption.

How often should I run a test restore?

At least monthly, or after any significant change to your system, such as a major OS upgrade or hardware replacement. For critical data, consider weekly test restores. Automate it with a script that restores to a temporary directory and deletes it afterward.

Does restic support two-factor authentication for the repository?

No, restic itself does not have two-factor authentication for the repository. However, you can enable 2FA on your cloud storage account to protect the storage access. The repository encryption still relies solely on your password.

Related

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.

More cards in this drawer

The whole Numbers and Powers drawer →