Skip to content

jan75/restic-backup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

Backup Script

  1. Prepare an S3 bucket to hold the backups
  2. Install restic, sudo and cron (or distribution equivalent) on the backup computer
  3. Create a new user on the server where you will perform the backups and disable login for the user
  4. Copy the scripts env.sh and restic.sh to the new users home directory
  5. Adjust the values in the files (which files to backup and retention in restic.sh, keys in env.sh)
  6. Adjust ownership and permissions on the files, especially env.sh as it contains sensitive keys (i.E. chown username ./env.sh ./restic.sh and chmod 600 ./env.sh ./restic.sh)
  7. Change sudo config by running visudo as root:
    • Allow the user to run restic (tool) as root without entering password: username ALL=(ALL) NOPASSWD: /usr/bin/restic (adjust path to restic binary if necessary)
    • Change the configured environment variables to be passed through to sudo by adding or adjusting the following line: Defaults env_keep += "RESTIC_REPOSITORY AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY RESTIC_PASSWORD"
  8. Add a cron job with the backup user (crontab -e): 0 2 * * wed,sun /home/username/restic.sh 2>&1 | /usr/bin/logger -t restic_backup (adjust cron string)
  9. Make sure to enable the cron system service

About

Simple script and description to setup backups

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages