Skip to content

Commit

Permalink
unshare: fix creating a userns when running as root
Browse files Browse the repository at this point in the history
this check would prevent the function to ever be used when running
as root, since we won't check what capabilities are currently
available to the process.

Signed-off-by: Giuseppe Scrivano <[email protected]>
(cherry picked from commit 1af3928)
  • Loading branch information
giuseppe committed Jan 16, 2023
1 parent 472e26b commit 1f6c35b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/unshare/unshare_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ type Runnable interface {
// MaybeReexecUsingUserNamespace re-exec the process in a new namespace
func MaybeReexecUsingUserNamespace(evenForRoot bool) {
// If we've already been through this once, no need to try again.
if os.Geteuid() == 0 && IsRootless() {
if os.Geteuid() == 0 && GetRootlessUID() > 0 {
return
}

Expand Down

0 comments on commit 1f6c35b

Please sign in to comment.