Automated daily restic backup to a Synology NAS over SFTP, driven by a systemd user timer.
restic-backup.timer— firesdaily(00:00).Persistent=true, so a missed run (machine off) executes on next boot.restic-backup.service—oneshotthat runsrestic backup, thenrestic forget --prunewith a 7 daily / 4 weekly / 6 monthly retention policy.
/home/c/Dokumente/HTB/home/c/Dokumente/GitHub/home/c/Dokumente/Obsidian Vault/home/c/Schreibtisch/home/c/Dokumente/Pentesting
Excludes: cache dirs (--exclude-caches), the GOAD workspace/, and
*.iso, *.tmp*, *.vmem, *.vmdk.
- Backend:
sftp:home-nas:/FW-COTI(Synology NAS) - Password: read from
~/.config/restic/password(not in this repo)
-
restic installed (
restic version). -
SSH host
home-nasin~/.ssh/config, e.g.:Host home-nas HostName 192.168.1.25 User c IdentityFile ~/.ssh/id_ed25519_restic
-
Password file at
~/.config/restic/password(mode600). -
Repository initialized once (only if it doesn't exist yet):
export RESTIC_REPOSITORY=sftp:home-nas:/FW-COTI export RESTIC_PASSWORD_FILE=~/.config/restic/password restic init
./install.shCopies the units into ~/.config/systemd/user/, enables the timer, and turns on
user lingering so backups run even when logged out.
export RESTIC_REPOSITORY=sftp:home-nas:/FW-COTI
export RESTIC_PASSWORD_FILE=~/.config/restic/password
systemctl --user start restic-backup.service # run a backup now
journalctl --user -u restic-backup.service -f # follow logs
systemctl --user list-timers restic-backup.timer
restic snapshots # list snapshots
restic check # verify repo integrity
restic restore latest --target /tmp/restore # restore latest