Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • D doc-website
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Artifacts
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Model experiments
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Systerserver
  • doc-website
  • Wiki
  • Container Backups with Restic

Container Backups with Restic · Changes

Page history
Restic command authored May 23, 2021 by Mara Karagianni's avatar Mara Karagianni
Show whitespace changes
Inline Side-by-side
Container-Backups-with-Restic.md
View page @ eb7df103
...@@ -32,7 +32,6 @@ To securely copy the public key, we shall enable password authentication at remo ...@@ -32,7 +32,6 @@ To securely copy the public key, we shall enable password authentication at remo
https://www.simplified.guide/ssh/copy-public-key https://www.simplified.guide/ssh/copy-public-key
**2. How to run the backup command without root privilege?** **2. How to run the backup command without root privilege?**
The idea is to execute the restic binary with a backup user, aka execute a binary meant for root without being root. The idea is to execute the restic binary with a backup user, aka execute a binary meant for root without being root.
As root we add a new user As root we add a new user
...@@ -56,8 +55,8 @@ Ref: https://restic.readthedocs.io/en/stable/080_examples.html#backing-up-your-s ...@@ -56,8 +55,8 @@ Ref: https://restic.readthedocs.io/en/stable/080_examples.html#backing-up-your-s
**3. How to run specific root commands by a non root user?** **3. How to run specific root commands by a non root user?**
*Note: we need that for stopping, checking status and starting of the lxc containers. *Note: we need that for stopping, checking status and starting of the lxc containers.
Best practice is to run our LXC containers rootless. This requires a different configuration of the containers' network setup, see details at Best practice is to run our LXC containers rootless. This requires a different configuration of the containers' network setup, see details at*
https://www.cyberciti.biz/faq/how-to-create-unprivileged-linux-containers-on-ubuntu-linux/* https://www.cyberciti.biz/faq/how-to-create-unprivileged-linux-containers-on-ubuntu-linux/
Here we will give the backupuser restricted root privilege for the specific lxc commands we need to run during the backup process. Here we will give the backupuser restricted root privilege for the specific lxc commands we need to run during the backup process.
...@@ -65,7 +64,30 @@ Give the backup user the access for specific commands to be executed as 'root'. ...@@ -65,7 +64,30 @@ Give the backup user the access for specific commands to be executed as 'root'.
Add these commands in a new file under /etc/sudoers.d/ Add these commands in a new file under /etc/sudoers.d/
`vi /etc/sudoers.d/00-backupuser` `vi /etc/sudoers.d/00-backupuser`
`bintibackup ALL=(ALL) NOPASSWD: /usr/bin/lxc-stop, /usr/bin/lxc-start, /usr/bin/lxc-info, /usr/bin/lxc-ls` `bintibackup ALL=(ALL) NOPASSWD: /usr/bin/lxc-stop, /usr/bin/lxc-start, /usr/bin/lxc-info, /usr/bin/lxc-ls`
*https://www.cyberciti.biz/faq/linux-unix-running-sudo-command-without-a-password/* https://www.cyberciti.biz/faq/linux-unix-running-sudo-command-without-a-password/
###Command to run backups from terminal
Needs the following parameters:
- path to password file:
PASSWORD="~backupuser/pass"
- absolute path to the remote backup repo:
remote-repo ="/var/backups"
- abosulte path to the directory we want to backup:
local-repo="/var/foo"
- remote host:
$host="backups.org"
$user="backuphost"
So the command becomes:
`& restic -p ~/backup/pass -r sftp:backuphost@backups.org:/var/backups --verbose backup /var/foo `
OR:
`# restic -p $PASSWORD -r sftp:$user@$host:$remote-path --verbose backup </code>
Clone repository
  • Container Backups with Restic
  • Mailing Lists Docs
  • Sysadmin tasks
  • Home