summaryrefslogtreecommitdiff
path: root/pkg/rootless
diff options
context:
space:
mode:
authorGiuseppe Scrivano <gscrivan@redhat.com>2018-07-16 10:10:20 +0200
committerAtomic Bot <atomic-devel@projectatomic.io>2018-07-16 13:40:40 +0000
commit6372c977ea0e6206d137e734a981ca0bb3435e12 (patch)
tree595fb9ddd51d169492fea0d2b5ffac63de476ba7 /pkg/rootless
parent06c546e88d67fe7186d3da9dc245e2122511927a (diff)
downloadpodman-6372c977ea0e6206d137e734a981ca0bb3435e12.tar.gz
podman-6372c977ea0e6206d137e734a981ca0bb3435e12.tar.bz2
podman-6372c977ea0e6206d137e734a981ca0bb3435e12.zip
rootless: require subids to be present
Most images won't work without multiple ids/gids. Error out immediately if there are no multiple ids available. The error code when the user is not present in /etc/sub{g,u}id looks like: $ bin/podman run --rm -ti alpine echo hello ERRO[0000] No subuid ranges found for user "gscrivano" Closes: https://github.com/projectatomic/libpod/issues/1087 Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com> Closes: #1097 Approved by: rhatdan
Diffstat (limited to 'pkg/rootless')
-rw-r--r--pkg/rootless/rootless_linux.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/pkg/rootless/rootless_linux.go b/pkg/rootless/rootless_linux.go
index 6089ad73a..3d6402040 100644
--- a/pkg/rootless/rootless_linux.go
+++ b/pkg/rootless/rootless_linux.go
@@ -104,6 +104,9 @@ func BecomeRootInUserNS() (bool, int, error) {
var uids, gids []idtools.IDMap
username := os.Getenv("USER")
mappings, err := idtools.NewIDMappings(username, username)
+ if err != nil && os.Getenv("PODMAN_ALLOW_SINGLE_ID_MAPPING_IN_USERNS") == "" {
+ return false, -1, err
+ }
if err == nil {
uids = mappings.UIDs()
gids = mappings.GIDs()