- 
- This project provides a fully automated, portable, and secure backup and restore system using Restic, with the following features:
 - Single editable source script (restic_backup_src.sh)
 - Encrypted production scripts (restic_backup.sh, restore.sh)
 - Argon2-based Restic password file
 - Logging of backups
 - Snapshot selection with human-readable timestamps
 - Automatic cron setup for unattended backups
 - Portable folder structure — no hardcoded paths
 - Restore script auto-generated by the backup script
 - Secure encryption of scripts using a passphrase-free SSH RSA key
 
 - 
restic-scripts/ # Main folder (portable) ├── src/ # Editable source │ └── restic_backup_src.sh # Single editable source ├── restic_backup.sh # Encrypted launcher stub ├── restic_backup.sh.enc # Encrypted backup logic ├── restore.sh # Encrypted launcher stub ├── restore.sh.enc # Encrypted restore logic- src/ contains the editable restic_backup_src.sh script. - Running restic_backup_src.sh generates all production scripts in the parent folder. - The entire folder is portable; cron jobs and scripts work using relative paths. - 
- 
- Linux: 
sudo apt update && sudo apt install restic openssh-client argon2 -y - MacOS: 
brew install restic argon2 
 - Linux: 
 - 
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"-t rsaspecifies the type of key to create (RSA).-b 4096specifies the number of bits in the key (4096 bits is recommended for security).-C your_email@example.comadds a label to the key, usually your email.- press 
Enterto accept the default location (~/.ssh/id_rsa) - When prompted to enter a passphrase, simply press 
Entertwice to leave it empty. 
 - 
cd /../restic-scriptssudo chmod -R 700 srcsudo chmod +x src/restic_backup_src.shcd ..# ORcd /../restic-scriptsgit branch -M maingit remote add origin git@github.com:cryptCEE/restic-scripts.gitgit remote -vgit add .git commit -S -m "Test commit with GPG signing"git push -u origin main
 - Make the source script executable:
chmod +x ~/restic-scripts/src/restic_backup_src.sh- Edit the source script to configure:
- BACKUP_PATHS: directories/files to back up
 - EXCLUDES: patterns to exclude from backups
 - RESTIC_REPOSITORY: location for the Restic repository
 - PLAIN_PASSWORD / SALT / Argon2 parameters
 
 
 
 - 
 - 
- 
- Run the editable source to perform a backup and generate encrypted scripts:
cd ~/restic-scripts/src./restic_backup_src.sh- What happens:
- Restic repository initialized if not present
 - Argon2 password file created (or reused)
 - Backup runs with specified paths and excludes
 - Old snapshots are pruned according to retention rules
 - Logs written to $RESTIC_REPOSITORY/logs/backup_YYYY-MM-DD.log
 - Cron job automatically installed (runs daily at 2 AM)
 - Restore script (restore.sh) is auto-generated and encrypted
 - Production scripts (restic_backup.sh and restore.sh) are encrypted and ready for use
 
 
 
 - Run the editable source to perform a backup and generate encrypted scripts:
 - 
- Backup:
~/restic-scripts/restic_backup.sh
 - Restore:
~/restic-scripts/restore.sh- Restore Behavior:
- Displays available snapshots (latest first) with timestamps
 - Ask for confirmation (default: Y)
 - Restores to $HOME/restic_restore by default
 
 
 
 - Backup:
 
 - 
 - 
- The backup script automatically installs a cron job:
0 2 * * * /home/<user>/restic-scripts/restic_backup.sh
 - Uses relative paths; works even if the folder is moved
 - Runs unattended using the SSH RSA key for decryption
 - Logs written to $RESTIC_REPOSITORY/logs
 
 - The backup script automatically installs a cron job:
 - 
- Scripts are encrypted using a passphrase-free SSH RSA key (~/.ssh/id_rsa)
 - Argon2-based password file (restic_pass) used by Restic
 - Backup and restore operations require only the presence of the private key
 
 - 
- Only edit src/restic_backup_src.sh
 - Running the source regenerates all production scripts
 - Do not manually edit restore.sh or .enc files — changes will be overwritten
 
 - 
- Test backup and restore on a small directory first.
 - Keep your SSH private key secure; it is required to run encrypted scripts.
 - Check logs for backup success/failures:
 less $RESTIC_REPOSITORY/logs/backup_YYYY-MM-DD.log- Move the restic-scripts folder as needed — all paths are relative.
 - Make sure restic and jq are installed on your system.
 
 - 
- 
- Run the source script (generates encrypted scripts and runs backup):
cd ~/restic-scripts/src./restic_backup_src.sh
 - Run the encrypted production backup script:
~/restic-scripts/restic_backup.sh
 
 - Run the source script (generates encrypted scripts and runs backup):
 - 
- Run the encrypted restore script:
~/restic-scripts/restore.sh
 - Displays snapshots (latest first)
 - Confirm with Y or just press Enter to restore
 - Restores to $HOME/restic_restore by default
 
 - Run the encrypted restore script:
 - 
- Check the latest backup log:
less $RESTIC_REPOSITORY/logs/backup_$(date '+%F').log
 
 - Check the latest backup log:
 - 
- Backup is scheduled automatically at 2 AM daily:
crontab -l | grep restic_backup.sh
 - Edit cron manually if needed:
crontab -e
 
 - Backup is scheduled automatically at 2 AM daily:
 
 - 
 
- 
                Notifications
    
You must be signed in to change notification settings  - Fork 0
 
cryptCEE/restic-scripts
Folders and files
| Name | Name | Last commit message  | Last commit date  | |
|---|---|---|---|---|
Repository files navigation
About
This project provides a fully automated, portable, and secure backup and restore system using Restic.
Topics
Resources
Stars
Watchers
Forks
Releases
No releases published
              Packages 0
        No packages published