Allow running borgmatic without root access #50

Closed
opened 2018-01-12 06:15:25 +00:00 by gnujedi · 5 comments

I recently reinstalled my GNU/Linux machine and to my surprise found that simply running borgmatic yielded Error: No configuration files found in: /etc/borgmatic/config.yaml /etc/borgmatic.d. If I used sudo borgmatic, it would start a backup. Personally, I only want to backup ~/, and I don't want to invoke root privileges. Is there anyway of doing this? I saw the -c method, but I'm also interested in using the systemd.service file to run backups in the background. I could be just missing somethings obvious. Thanks for your time.

I recently reinstalled my GNU/Linux machine and to my surprise found that simply running `borgmatic` yielded `Error: No configuration files found in: /etc/borgmatic/config.yaml /etc/borgmatic.d`. If I used `sudo borgmatic`, it would start a backup. Personally, I only want to backup `~/`, and I don't want to invoke root privileges. Is there anyway of doing this? I saw the `-c` method, but I'm also interested in using the `systemd.service` file to run backups in the background. I could be just missing somethings obvious. Thanks for your time.
Owner

As far as I know, running borgmatic as non-root should totally be possible. Your instinct is correct that you'd need to select a non-root configuration file with -c.

I haven't used systemd.service myself, but if it's possible to set that up as a non-root user to run scheduled jobs, then that should work for your needs. I know for instance that crond is configurable as a non-root user.

Let me know if this all works for you or if you run into any roadblocks.

As far as I know, running borgmatic as non-root should totally be possible. Your instinct is correct that you'd need to select a non-root configuration file with `-c`. I haven't used `systemd.service` myself, but if it's possible to set that up as a non-root user to run scheduled jobs, then that should work for your needs. I know for instance that crond is configurable as a non-root user. Let me know if this all works for you or if you run into any roadblocks.
witten added the
question / support
label 2018-01-12 06:49:36 +00:00
Author

Okay, I'll do some more testing later today. Question: is running borgmatic supposed to be from an unprivileged user (ie no sudo borgmatic)?

Okay, I'll do some more testing later today. Question: is running `borgmatic` supposed to be from an unprivileged user (ie no `sudo borgmatic`)?
Owner

Yes, as far as I know, it should be able to run as a non-root user as long as that user has permissions to do everything it needs to do (read config files, write to the selected Borg repository, etc).

I'll close this in favor of #51, but if you encounter any other issues while running as non-root, please let me know.

Yes, as far as I know, it should be able to run as a non-root user as long as that user has permissions to do everything it needs to do (read config files, write to the selected Borg repository, etc). I'll close this in favor of #51, but if you encounter any other issues while running as non-root, please let me know.
Author

Thanks for the input. The issue stemmed from running sudo generate-borgmatic-config. It didn't give any account access permission to read the contents of /etc/borgmatic/config.yaml. After comparing the permissions with other directories in /etc (like /etc/apt), I changed the permission to "Access Files" (which is the same as the other directories in the /etc tree). Now, it runs great.

Thanks for the input. The issue stemmed from running `sudo generate-borgmatic-config`. It didn't give any account access permission to read the contents of `/etc/borgmatic/config.yaml`. After comparing the permissions with other directories in `/etc` (like `/etc/apt`), I changed the permission to "Access Files" (which is the same as the other directories in the `/etc` tree). Now, it runs great.
Owner

Great, glad to hear it!

Great, glad to hear it!
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: borgmatic-collective/borgmatic#50
No description provided.