Can I switch between root and non-root user when creating archives? #7348
-
I have a repo that I created using my local user account (non-root) and I have been creating archives automatically without issues by using my user crontab. Recently, I modified my shell script to be able to mount and unmount my external HDD during a borg backup, and unfortunately, that requires root privileges. I was about to run my script as root, but I remembered reading something about permission issues when mixing root and non-root accounts, thus I wanted to ask if creating an archive as a root user in this case would lead to issues? or what would happen if I went ahead with it? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
The process that accesses the repository files (which is If you later access these files and you use the same user, there won't be a problem as you will have permissions. But if you use a different user, you usually won't have permissions (the only exception being root as root is always permitted to access everything). So the advice is to always use the same user to access a repo. For a client/server setup this usually is no problem as long as you use the same |
Beta Was this translation helpful? Give feedback.
-
mount: you could just do the mounting / umounting as root (sudo!?) and run borg as user. whether different users can r/w their files depends on the umask being set (which determines the mode of newly created files). The files need to have rw-rw---- mode, thus the umask should be 0007 for that purpose. yes, everything written to same borg repository will automatically get deduplicated. |
Beta Was this translation helpful? Give feedback.
The process that accesses the repository files (which is
borg serve
if you run client/server orborg create
if you do not use assh://
repo) creates files inside the repository directory. And these files will be owned by the user/group of that process.If you later access these files and you use the same user, there won't be a problem as you will have permissions. But if you use a different user, you usually won't have permissions (the only exception being root as root is always permitted to access everything).
So the advice is to always use the same user to access a repo. For a client/server setup this usually is no problem as long as you use the same
ssh://borg@reposerver/...
url. For a…