summaryrefslogtreecommitdiff
path: root/libpod
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2019-08-20 18:44:50 +0200
committerGitHub <noreply@github.com>2019-08-20 18:44:50 +0200
commita3c46fcaf4a6276f6648c830d550809924e679e7 (patch)
tree39b9e8f00108d4353a27a020110cf079885ae526 /libpod
parent230faa864f8922f16a0d70c4a3454d51768e9a15 (diff)
parentcc3d8da9683414bda2b650cb46a0b54ce0e6a263 (diff)
downloadpodman-a3c46fcaf4a6276f6648c830d550809924e679e7.tar.gz
podman-a3c46fcaf4a6276f6648c830d550809924e679e7.tar.bz2
podman-a3c46fcaf4a6276f6648c830d550809924e679e7.zip
Merge pull request #3858 from haircommander/exec-user
exec: run with user specified on container start
Diffstat (limited to 'libpod')
-rw-r--r--libpod/container_api.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/libpod/container_api.go b/libpod/container_api.go
index abcfcb271..9e59104cc 100644
--- a/libpod/container_api.go
+++ b/libpod/container_api.go
@@ -274,6 +274,11 @@ func (c *Container) Exec(tty, privileged bool, env, cmd []string, user, workDir
}
}()
+ // if the user is empty, we should inherit the user that the container is currently running with
+ if user == "" {
+ user = c.config.User
+ }
+
pid, attachChan, err := c.ociRuntime.execContainer(c, cmd, capList, env, tty, workDir, user, sessionID, streams, preserveFDs, resize, detachKeys)
if err != nil {
ec := define.ExecErrorCodeGeneric