From 433a8cf0d2f99b9b122d6fb8afd581e36dabe429 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Thu, 17 Feb 2022 15:35:36 +0100 Subject: vidhar: ... --- hosts/vidhar/borg/copy.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'hosts') diff --git a/hosts/vidhar/borg/copy.py b/hosts/vidhar/borg/copy.py index 66846394..fa698029 100755 --- a/hosts/vidhar/borg/copy.py +++ b/hosts/vidhar/borg/copy.py @@ -96,8 +96,8 @@ def copy_archive(src_repo_path, dst_repo_path, entry): # print('unshare/chroot', file=stderr) uid, gid = os.getuid(), os.getgid() unshare.unshare(unshare.CLONE_NEWNS | unshare.CLONE_NEWUSER) - # with open('/proc/self/setgroups', 'w') as setgroups: - # setgroups.write('deny') + with open('/proc/self/setgroups', 'w') as setgroups: + setgroups.write('deny') # with open('/proc/self/uid_map', 'w') as uid_map: # uid_map.write(f'0 {uid} 1') # with open('/proc/self/gid_map', 'w') as gid_map: @@ -105,10 +105,10 @@ def copy_archive(src_repo_path, dst_repo_path, entry): pyprctl.cap_permitted.sys_admin = True pyprctl.cap_inheritable.sys_admin = True pyprctl.cap_ambient.sys_admin = True - # with open('/proc/self/uid_map', 'w') as uid_map: - # uid_map.write(f'{uid} {uid} 1') - # with open('/proc/self/gid_map', 'w') as gid_map: - # gid_map.write(f'{gid} {gid} 1') + with open('/proc/self/uid_map', 'w') as uid_map: + uid_map.write(f'0 0 1\n{uid} {uid} 1') + with open('/proc/self/gid_map', 'w') as gid_map: + gid_map.write(f'0 0 1\n{gid} {gid} 1') subprocess.run(['mount', '--make-rprivate', '/'], check=True) chroot = pathlib.Path(tmpdir) / 'chroot' upper = pathlib.Path(tmpdir) / 'upper' -- cgit v1.2.3