Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Override permissions for borg mount #362

Closed
m3nu opened this issue Oct 6, 2019 · 6 comments · Fixed by #363
Closed

Override permissions for borg mount #362

m3nu opened this issue Oct 6, 2019 · 6 comments · Fixed by #363
Labels
status:planning For large features, plan it out before implementation

Comments

@m3nu
Copy link
Contributor

m3nu commented Oct 6, 2019

Problem
I sometimes restore backups of remote servers. Most files there would belong to other users, like root. Using default mount options, borg mount will use the original permissions, thus denying access to normal users.

Solution
Since Vorta targets desktops, I suggest to always run borg mount with the following options to give the current user read access:

borg mount -o umask=0277,uid=$UID [email protected]:repo::2019-04-30-1556602978 mnt

Describe alternatives you've considered
Not aware of alternatives. The above solution only partly solves the problem. Backups that use ACL (e.g. from Synology NAS) still need to be mounted as root and won't work as normal user on macOS, even with permissions set as above. It works fine on Linux though.

Any opinion on this or issues you experienced, @Hofer-Julian @ThomasWaldmann

@m3nu m3nu added the status:planning For large features, plan it out before implementation label Oct 6, 2019
@ThomasWaldmann
Copy link
Collaborator

Well, guess it depends a bit on your goal, but if we assume it is "restoring other users' files to the state as they were at backup time", borg mount is not the right way anyway as it does not deal with all metadata.

Nor could you chown to the correct uid/gid if you are not root.

So, backup and restore for other users' files needs to be done as root, using borg create/extract.

@m3nu
Copy link
Contributor Author

m3nu commented Oct 6, 2019

Thanks for weighing in. Usually my main use case with borg mount is to grab just a few files from the backup. I wouldn't restore a larger portion with it.

If most people use it like this, always changing the owner and permissions would make sense. So curious to get more feedback.

@Hofer-Julian
Copy link
Collaborator

I just tried borg mount without -o umask=0277,uid=$UID and while it did retain the original permissions, the owner of all files and directories was my current user julian:julian, while the user owning the files/directories on the server is www-data:www-data.

@m3nu
Copy link
Contributor Author

m3nu commented Oct 6, 2019

On macOS it will retain the original user as well, which makes it mostly useless when working with a random server backup.

There seem to be small differences between OSs. That's why I'm all for normalizing this, so I can quickly grab a few files without having to run borg as root.

For complex scenarios there is borg extract anyways.

@Hofer-Julian
Copy link
Collaborator

Hofer-Julian commented Oct 6, 2019

On macOS it will retain the original user as well. There seem to be small differences between OSs.

Or Fedora specific? I tried it inside and outside of a Flatpak and got the same result.

But back to the original question, I am all for adding -o umask=0277,uid=$UID.
I personally never had this problem, but it seems like a problem the average user might despair when confronted with it.

@m3nu
Copy link
Contributor Author

m3nu commented Oct 7, 2019

Thanks for weighing in everyone. Did a (very simple) PR and tested with a client NAS that often loses some data. Works all well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:planning For large features, plan it out before implementation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants