fix: map gid instead uid

This commit is contained in:
Maxim Slipenko 2025-04-06 17:22:06 +03:00
parent 9480a710ee
commit 5404bda3de

@ -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,
})