borgbackup / borgbackup/borg

create: add an --add-parents option?

Open
#5,680 10 comments 0 reactions 0 assignees View on GitHub
cmd: create question
Dominant language
Python
Stars
13.7k
Forks
875
Avg merge
11h 15m
Merged PRs (30d)
192

Description

## Have you checked borgbackup docs, FAQ, and open Github issues?

Yes

## Is this a BUG / ISSUE report or a QUESTION?

Question, maybe a bug

## System information. For client/server mode post info for both machines.

#### Your borg version (borg -V).
1.1.15

#### Operating system (distribution) and version.
Fedora 32

#### Hardware / network configuration, and filesystems used.
No network, local filesystem only: btrfs, fuse, tmpfs

#### How much data is handled by borg?
~1GB

#### Full borg commandline that lead to the problem (leave away excludes and passwords)

Let's check ownership and file permissions of home directories:
```
ls -l /home/
drwx------. 62 user1 user1 4096 9. Feb 21:15 user1
drwx------. 16 user2 user2 4096 8. Feb 22:19 user2
```

As root:
Create a repository and backup /home/user2 and /home/user1/subdir
```
borg init --encryption=repokey-blake2 --storage-quota=10G --make-parent-dirs /tmp/borgtest/{hostname}
borg create --progress --stats /tmp/borgtest/{hostname}::{now} /home/user1/subdir /home/user2
```

Mount the backup to allow users to restore their own files:
```
mkdir /tmp/borgtest/mount
borg mount -o allow_other /tmp/borgtest/{hostname} /tmp/borgtest/mount
chmod 755 /tmp/borgtest
```

As user1:
```
cd /tmp/borgtest/mount/2021-02-09T20:46:05/home
ls -l
drwxr-xr-x. 1 root root 0 9. Feb 20:47 user1
drwx------. 1 user2 user2 0 8. Feb 22:19 user2
```
Homedirectory of user1 is owned by root and permissions are set to 755!?

As root again:
Let's check what borg extract does, to see if this behaviour is fuse specific:
```
borg umount /tmp/borgtest/mount
mkdir /tmp/borgtest/restore
cd /tmp/borgtest/restore/
borg extract --progress --strip-components=1 /tmp/borgtest/{hostname}::2021-02-09T20:46:05
ls -l
drwx------. 3 root root 60 9. Feb 20:51 user1
drwx------. 16 user2 user2 600 8. Feb 22:19 user2
```
Ownership is still root/root, but permissions looks okay. So this differs from source and borg mount.

## Describe the problem you're observing.
Directory ownership differs from source if only a subdirectory is backed up.
Directory ownership and permissions differs from source if only a subdirectory is backed up and repository is mounted with fuse.

Questions is: Did I made a mistake? Is this behaviour intended and I missed something in the documentation? Or did I found a bug?

#### Can you reproduce the problem? If so, describe how. If not, describe troubleshooting steps you took before opening the issue.
Yes, I can reproduce this as described. The above is a real world example, only user and directory names have been replaced for privacy .
I double checked with other homedirs and subdirectories and still had the same behaviour when mounting with fuse.

#### Include any warning/errors/backtraces from the system logs
None on stdout, dmesg or journalctl

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.