MCPcopy Create free account
hub / github.com/containers/image / GetRootlessEUID

Function GetRootlessEUID

internal/rootless/rootless.go:18–25  ·  view source on GitHub ↗

GetRootlessEUID returns the UID of the current user (in the parent userNS, if any) Podman and similar software, in “rootless” configuration, when run as a non-root user, very early switches to a user namespace, where Geteuid() == 0 (but does not switch to a limited mount namespace); so, code relyin

()

Source from the content-addressed store, hash-verified

16// If Podman is setting up such a user namespace, it records the original UID in an
17// environment variable, allowing us to make choices based on the actual user’s identity.
18func GetRootlessEUID() int {
19 euidEnv := os.Getenv("_CONTAINERS_ROOTLESS_UID")
20 if euidEnv != "" {
21 euid, _ := strconv.Atoi(euidEnv)
22 return euid
23 }
24 return os.Geteuid()
25}

Callers 4

shortNameAliasesConfPathFunction · 0.92
DefaultCacheFunction · 0.92
CleanupDefaultCacheFunction · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…