-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Restoring with --include creates directories with wrong permissions on the way down. #1402
Comments
Thanks for raising this issue. I'm not sure that setting the previous access rights on intermediate directories in the right way forward, let me think about this for a bit. Any other thoughts on the matter? |
To me, this definitely looks like a bug/problem in the restoration functionality. If I'm restoring data that originally belonged to some user into a directory that's accessible by this user, I expect this user to be able to access the restored data, even if only a part was restored. Restoring directory attributes (owner/access/etc) looks like a natural way to achieve this. Also, the current behaviour is perceived as restic "half-restoring" these intermediate directories (their existence is restored, but their attributes aren't), which seems inconsistent/illogical. |
I think this is a bug. If I want to restore part of a backup, the restored copy should be usable. Currently it is unusable without performing restic ls operations to discover the proper permissions, owner and group of each path element that was autocreated. It really makes restores of files/directories difficult. |
I agree that what is restored by restic should be restored in a consistent manner (that is, either with "default" permissions of the user running the restore, or with the permissions etc from the original files and folders that were backed up, not a combination of the two). I can however see a use case in both types of permissions:
I think the reasonable way forward is that one can control what ownership and/or permissions restic restores by some option(s) to the restore command. |
Can someone please confirm that it's still an issue? Since 0.7.3 was released, we've made a few changes to the permission (and timestamp) handling for intermediate directories... |
This allows leaveDir to set metadata properly for directories with descendants that are selected by an include filter, even if the directory in question isn't selected by that filter. For example, let's say you have the following file in your repo: /home/user/nested/data/values.txt ...and / and /home are owned by root, but /home/user and below are owned by user. If you run "restic restore -i /home/user/nested/data -t /tmp/restore $SNAPSHOT" as root, /home/user/nested/ will currently be restored with root as the owner, even though it's supposed to be owned by user. This change makes sure that leaveDir is called to restore metadata to nodes like /home/user/nested - enterDir is also called under the same circumstances for purposes of symmetry. This fixes GH restic#1402 and (I think) GH restic#2563
Output of
restic version
restic 0.7.3
compiled with go1.9 on linux/amd64
How did you run restic exactly?
See details below
What backend/server/service did you use?
Client: Debian Stable (9.2)
Server: FreeBSD 11.1 server in the LAN using OpenSSH (OpenSSH_7.2p2, OpenSSL 1.0.2k-freebsd 26 Jan 2017)
Expected behavior
The all directories should be created with the original permissions and ownership, even if you only restore files being deep in the hierarchy.
Actual behavior
When restoring files lying deep in the hierarchy the directories on the way down are restored with a different user and permission as they had on the original.
Steps to reproduce the behavior
Do you have any idea what may have caused this?
I would think that directories on the way down are not "restored" but just "created" with "secure defaults".
Do you have an idea how to solve the issue?
restore the empty directories instead of just creating them.
The text was updated successfully, but these errors were encountered: