Sample Header Ad - 728x90

How to use a remote borg backup as root?

2 votes
1 answer
2809 views
I want to backup some files that can only be read as root to a remote repository that only my user has access to. If I run borg as myself using /etc as my source I'll get permission-denied errors when trying to read some files like /etc/crypttab. If I run borg as root with sudo, the files can be read but I can't write to the repository because my local root user doesn't have ssh access to the remote repository and it doesn't have the repo key for that repository (ie /root/.borg/ doesn't exist). To recap:
$ borg create ssh://me@remote:/backup/my_repo.borg::demo /etc
will error because I can't read some files in /etc, which I _do want backed up_. And
$ sudo borg create ssh://me@remote:/backup/my_repo.borg::demo /etc
will fail because root doesn't have neither access to ssh://me@remote nor the repokey. Now an obvious work around would be give root ssh access and the repo key but I'm wondering if there is a better solution.
Asked by cheezsteak (566 rep)
Dec 6, 2020, 02:43 AM
Last activity: Dec 6, 2020, 03:00 AM