RESTIC
Foreword
For this project, we use restic through the user ss2idev. Don't forget to "source" .restic-backup.
Install
sudo apt update
sudo apt install restic
Init restic repo
restic -r sftp:fibre.ss2i-services.fr:/share/homes/Devadmin/backups/prestaservice/harmony/test/ init
A challenge password is requested. Never forget it :).
Global configuration
Create ~/.ssh/config file
touch ~/.ssh/config && chmod 600 ~/.ssh/config
nano ~/.ssh/config
~/.ssh/config content
Host fibre.ss2i-services.fr
User Devadmin
Port 22447
IdentityFile ~/.ssh/id_rsa
Create .restic variables
touch ~/.restic-backup && chmod 600 ~/.restic-backup
nano ~/.restic-backup
~/.restic-backup content
export RESTIC_REPOSITORY="sftp:fibre.ss2i-services.fr:/share/homes/Devadmin/backups/prestaservice/harmony/test/"
export RESTIC_PASSWORD="xxx"
Restic backup script
Create backup script
touch ~/restic-backups.sh && chmod +x ~/restic-backups.sh
nano ~/restic-backups.sh
~/restic-backups.sh content
#!/bin/bash
source ~/.restic-backup
restic backup /opt --tag harmony-datas
Some commands
List snapshots
restic snapshots
Remove snapshot
restic forget <snapshot_id>
Cleanup unreferenced datas
restic prune
Remove and cleanup unreferenced datas
restic forget --keep-last 1 --prune
Add password key
restic key add
List password keys
restic key list