Docs / Backup & Recovery / Setting Up Restic for Encrypted Cloud Backups

Setting Up Restic for Encrypted Cloud Backups

By Admin · Feb 25, 2026 · Updated Apr 24, 2026 · 83 views · 2 min read

What Is Restic?

Restic is a fast, secure backup program that supports multiple storage backends including local disk, SFTP, AWS S3, Backblaze B2, and Google Cloud Storage. All data is encrypted by default.

Installation

sudo apt install -y restic
# Or get the latest version
wget https://github.com/restic/restic/releases/download/v0.16.3/restic_0.16.3_linux_amd64.bz2
bunzip2 restic_*.bz2 && chmod +x restic_* && sudo mv restic_* /usr/local/bin/restic

Initialize a Repository

# Local
restic init --repo /backups/restic-repo

# SFTP
restic init --repo sftp:user@backup-server:/backups/restic

# S3
export AWS_ACCESS_KEY_ID=your-key
export AWS_SECRET_ACCESS_KEY=your-secret
restic init --repo s3:s3.amazonaws.com/mybucket/restic

# Backblaze B2
export B2_ACCOUNT_ID=your-id
export B2_ACCOUNT_KEY=your-key
restic init --repo b2:mybucket:restic

Create a Backup

# Backup directories
restic -r /backups/restic-repo backup /var/www /etc /home

# With exclusions
restic -r /backups/restic-repo backup /var/www --exclude="*.log" --exclude="node_modules"

List and Restore Snapshots

# List all snapshots
restic -r /backups/restic-repo snapshots

# Restore latest snapshot
restic -r /backups/restic-repo restore latest --target /tmp/restore

# Restore specific files
restic -r /backups/restic-repo restore latest --target /tmp/restore --include "/var/www"

Automated Backup Script

#!/bin/bash
export RESTIC_REPOSITORY="/backups/restic-repo"
export RESTIC_PASSWORD="your-secure-password"

restic backup /var/www /etc /home --exclude="*.log"
restic forget --keep-daily 7 --keep-weekly 4 --keep-monthly 6 --prune
restic check

Key Features

  • Deduplication — only stores unique data chunks
  • Encryption — AES-256 encryption for all data
  • Cross-platform — works on Linux, macOS, Windows
  • Fast — incremental backups complete quickly

Was this article helpful?