summaryrefslogtreecommitdiff
path: root/pkg/specgen/generate
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2020-06-30 15:44:14 -0400
committerValentin Rothberg <rothberg@redhat.com>2020-08-11 14:58:29 +0200
commit3dfd8630a51a37734ad8c51162c4d004b8ffffb2 (patch)
tree6ebf1d923f718c6717add408a11c714070ccc995 /pkg/specgen/generate
parent92d01d76c63d0a286365f610151524fb24b74e16 (diff)
downloadpodman-3dfd8630a51a37734ad8c51162c4d004b8ffffb2.tar.gz
podman-3dfd8630a51a37734ad8c51162c4d004b8ffffb2.tar.bz2
podman-3dfd8630a51a37734ad8c51162c4d004b8ffffb2.zip
Add username to /etc/passwd inside of container if --userns keep-id
If I enter a continer with --userns keep-id, my UID will be present inside of the container, but most likely my user will not be defined. This patch will take information about the user and stick it into the container. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'pkg/specgen/generate')
-rw-r--r--pkg/specgen/generate/namespaces.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/pkg/specgen/generate/namespaces.go b/pkg/specgen/generate/namespaces.go
index 39a45398d..22670ca61 100644
--- a/pkg/specgen/generate/namespaces.go
+++ b/pkg/specgen/generate/namespaces.go
@@ -153,7 +153,9 @@ func namespaceOptions(ctx context.Context, s *specgen.SpecGenerator, rt *libpod.
// User
switch s.UserNS.NSMode {
case specgen.KeepID:
- if !rootless.IsRootless() {
+ if rootless.IsRootless() {
+ toReturn = append(toReturn, libpod.WithAddCurrentUserPasswdEntry())
+ } else {
// keep-id as root doesn't need a user namespace
s.UserNS.NSMode = specgen.Host
}