Skip to content

Commit

Permalink
Only set extra_groups for mkdir() if we were invoked as root
Browse files Browse the repository at this point in the history
The extra groups of the user are not mapped into the user namespace
we create and as such can't be set when invoking a subprocess if
we weren't invoked as root.
  • Loading branch information
DaanDeMeyer committed Mar 21, 2024
1 parent a9e9a8a commit b2c843e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mkosi/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def mkdir(cls, path: Path) -> Path:
["mkdir", "--parents", path],
user=cls.uid if cond else os.getuid(),
group=cls.gid if cond else os.getgid(),
extra_groups=cls.extra_groups() if cond else None,
extra_groups=cls.extra_groups() if cls.invoked_as_root and cond else None,
)
return path

Expand Down

0 comments on commit b2c843e

Please sign in to comment.