borgbackup / borg

Deduplicating archiver with compression and authenticated encryption.
https://www.borgbackup.org/
Other
11.25k stars 747 forks source link

extract: should borg warn if chown/chgrp missed permissions? #8088

Open wspatgithub opened 9 months ago

wspatgithub commented 9 months ago

Have you checked borgbackup docs, FAQ, and open GitHub issues?

Yes

Is this a BUG / ISSUE report or a QUESTION?

Question

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

Your borg version (borg -V).

borg 1.2.6

Operating system (distribution) and version.

Synology OS

Hardware / network configuration, and filesystems used.

How much data is handled by borg?

just a few for testing

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

borg init --remote-path /usr/local/bin/borg --encryption=repokey-blake2 borg-backup@192.168.60.20:/volume1/Hauptsicherung_SynoOlmi/borg_backup_repo

borg list --remote-path /usr/local/bin/borg borg-backup@192.168.60.20:/volume1/Hauptsicherung_SynoOlmi/borg_backup_repo/::DiskStation-2024-02-10T13:28:51

borg extract --remote-path /usr/local/bin/borg borg-backup@192.168.60.20:/volume1/Hauptsicherung_SynoOlmi/borg_backup_repo/::DiskStation-2024-02-10T13:28:51 volume1/kodi

borg extract --remote-path /usr/local/bin/borg --numeric-ids borg-backup@192.168.60.20:/volume1/Hauptsicherung_SynoOlmi/borg_backup_repo/::DiskStation-2024-02-10T13:28:51 volume1/kodi

Describe the problem you're observing.

I can create the repo, doing the backup and after that, find the files I've backup'ed in the repo. With the detailed list command I can see, that Owner and Goup name is stored inside the repo:

drwxrwxrwx Wolfgang users         0 Sat, 2023-03-11 16:30:53 volume1/kodi/Repositories-old
-rwxrwxrwx admin  users    437729 Tue, 2022-12-27 10:49:57 volume1/kodi/Repositories-old/repository.kodinerds-7.0.1.2(1).zip
-rwxrwxrwx Wolfgang users  33603100 Thu, 2020-01-09 16:07:48 volume1/kodi/Repositories-old/xbmc-master.zip
-rwxrwxrwx Wolfgang users    247288 Sat, 2023-03-11 16:20:42 volume1/kodi/Repositories-old/script.skin.helper.skinbackup-master.zip
-rwxrwxrwx Wolfgang users    761623 Mon, 2021-01-04 17:24:46 volume1/kodi/Repositories-old/repository.guilouz-1.0.3.zip
-rwxrwxrwx Wolfgang users   5271150 Wed, 2020-01-08 16:58:56 volume1/kodi/Repositories-old/repository.membrane-master.zip  

After the restore with borg extract I find all my files belonging to admin / users. I tried extract with and without the parameter --numeric-ids, the result is still the same.

What do I have to do to change this behavior?

Additional Info: Files to be backed up are on my Synology NAS A, the repo is on my Synology NAS B.

Thanks Wolfgang

Can you reproduce the problem? If so, describe how. If not, describe troubleshooting steps you took before opening the issue.

Include any warning/errors/backtraces from the system logs

ThomasWaldmann commented 9 months ago

Did you run borg extract as root?

root is required to change user or group away from the current user/group.

wspatgithub commented 9 months ago

Hi Thomas,

thanks for that hint. Indeed, after I run borg extract from the root user, everything works as expected. Maybe I didn't read the doc's carefully enough.

Thanks Wolfgang

ThomasWaldmann commented 9 months ago

Not sure the docs point that out, but this is how chown/chgrp works on UNIX / Linux / ... in general.

Just imagine you could create a suid binary owned by your user and then you could chown that to root. :-)

tantalum commented 5 months ago

Should borg display and error and/or exit if the --numeric-ids option is used and the app doesn't have the permissions needed to set the correct ids?

ThomasWaldmann commented 5 months ago

@tantalum borg silently ignores any chown/chgrp failure due to missing permissions since ever (assuming that you will be happy with just the file contents in such a usage scenario, when invoking borg as non-root user).

if you need chown/chgrp (or anything else only possible as root), you need to invoke borg as root.