- Prepare an S3 bucket to hold the backups
- Install
restic
,sudo
andcron
(or distribution equivalent) on the backup computer - Create a new user on the server where you will perform the backups and disable login for the user
- Copy the scripts
env.sh
andrestic.sh
to the new users home directory - Adjust the values in the files (which files to backup and retention in
restic.sh
, keys inenv.sh
) - Adjust ownership and permissions on the files, especially
env.sh
as it contains sensitive keys (i.E.chown username ./env.sh ./restic.sh
andchmod 600 ./env.sh ./restic.sh
) - 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"
- Allow the user to run
- 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) - Make sure to enable the cron system service
-
Notifications
You must be signed in to change notification settings - Fork 0
jan75/restic-backup
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
Simple script and description to setup backups
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published