When running as a normal user, automatically use ~/.config/borgmatic/config.yaml #444
Labels
No Label
bug
data loss
design finalized
good first issue
new feature area
question / support
security
waiting for response
No Milestone
No Assignees
3 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: borgmatic-collective/borgmatic#444
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What I'm trying to do and why
I have system backups from desktop and NFS server running via borgmatic, but want to back up key files to another repository. Some of those files are on the desktop and some on the NFS server, and these are not readable by root on the desktop, but all these key files are readable by my normal user.
I am doing this by supplying -c ~/.config/borgmatic/config.yaml as an argument to borgmatic, but a potential improvement would be that if /etc/borgmatic/config.yaml is unreadable due to permission denied, then to look for a user config file and use that if it exists and the command line argument is not supplied.
Note that everything works as expected by supplying the configuration file when needed. This is a suggestion to make things easier for users without root or sudo access to set up their own backups a little more smoothly
Other notes / implementation ideas
This could also apply to generate-borgmatic-config and valiadate-borgmatic-config.
Environment
borgmatic version:
1.5.12-2
borgmatic installation method:
Debian package, but briefly tried pip install on a test system
Borg version:
borg 1.1.16
Python version:
Python 3.9.2
operating system and version:
Debian bullseye
Hi @JohnLines
borgmatic --help
showsSo renaming
$HOME/.config/borgmatic
to$HOME/.config/borgmatic.d
does the trick.Best regards
@JohnLines, could you provide some more detail about the permission denied error you're getting when you run borgmatic and it's probing for configuration files? When I try making my
/etc/borgmatic/config.yaml
file unreadable to a non-root user, and then create~/.config/borgmatic/config.yaml
in a non-root user's home directory that is readable, borgmatic consumes that user configuration file just fine without error. I've tried this on both borgmatic master and 1.5.12 (which you're using).Maybe this is something specific to NFS or a mounted filesystem?
I tried renaming my config from .config/borgmatic/config.yaml to .config/borgmatic.d/config.yaml - and have the same symptoms, but investigating further, running
borgmatic -v 2 info
I actually get the info (and it shows my config files are being read) and the issue actually shows at the end at
so the issue is not, as I had thought, at the start, parsing the files, but at the end.
If I supply a config file, by running as
borgmatic -v 2 -c .config/borgmatic/config.yaml info
then I do not get an error message. It may be specific to something which is done as a tidy up stage only when running an offsite repository.
Aha! I have a repro now. The trick was putting the unreadable configuration file in
/etc/borgmatic.d/
instead of/etc/borgmatic/
. Now, to figure out what to do about it...Okay, this has been fixed in borgmatic master by treating permissions errors when loading configuration files as warnings instead of errors. Example:
Thanks for reporting this! It'll be released as part of the next borgmatic release.
Released in borgmatic 1.5.24.