From 5404bda3decb102dba19ccbbf329e2c4a5669ff0 Mon Sep 17 00:00:00 2001 From: Maxim Slipenko Date: Sun, 6 Apr 2025 17:22:06 +0300 Subject: [PATCH] fix: map gid instead uid --- fakeroot.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fakeroot.go b/fakeroot.go index 37a755a..4c1f9e0 100644 --- a/fakeroot.go +++ b/fakeroot.go @@ -27,6 +27,7 @@ func Command(name string, arg ...string) (*exec.Cmd, error) { // registered in the command. func Apply(cmd *exec.Cmd) error { uid := os.Getuid() + gid := os.Getgid() // If the user is already root, there's no need for fakeroot if uid == 0 { @@ -59,7 +60,7 @@ func Apply(cmd *exec.Cmd) error { cmd.SysProcAttr.GidMappings = append(cmd.SysProcAttr.GidMappings, syscall.SysProcIDMap{ ContainerID: 0, - HostID: uid, + HostID: gid, Size: 1, })