-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: user not properly added to /etc/passwd and /etc/group for container created in a pod using --userns keep-id #17148
Comments
@rhatdan PTAL |
I didn’t mention it at first but, quite logically, |
Works for standard containers.
|
|
Looks like the username is being replaced with the hostname/containerid. |
Indeed, it does work with pod created on the fly (I didn’t know it was even possible by the way).
However, when the pod is created beforehand, it does not work.
|
Fixes: containers#17148 Signed-off-by: Daniel J Walsh <[email protected]>
Issue Description
The
/etc/passwd
differs between a rootless container created in a pod using--userns keep-id
and a standalone rootless container using--userns keep-id
. In a pod container, the (current running) user name (e.g. jdoe) is not added, its user id (e.g. 1000) is used instead.For example, the improper
/etc/passwd
line for the current user looks like1003:*:1003:1003:container user:/:/bin/sh
instead ofbmenant:*:1003:1003:Benjamin Menant:/:/bin/sh
.This leads to errors when a program reads a container’s
/etc/passwd
and looks for the current user name in the container (e.g. VS Code Dev Container extension does so when attaching to a container).Steps to reproduce the issue
$ podman pod create --userns keep-id --name test-pod-with-keep-id
$ podman create --pod test-pod-with-keep-id busybox /bin/tail -n 1 /etc/passwd
$ podman pod start -l
$ podman pod logs -l
Describe the results you received
(for
whoami
=>bmenant
andid -u
=> 1003)6bbbcdd3dda6 1003:*:1003:1003:container user:/:/bin/sh
Describe the results you expected
6bbbcdd3dda6 bmenant:*:1003:1003:Benjamin Menant:/:/bin/sh
podman info output
Podman in a container
No
Privileged Or Rootless
Rootless
Upstream Latest Release
Yes
Additional environment details
No response
Additional information
The container run outside of the pod:
$ podman create --userns keep-id busybox:latest /bin/tail -n 1 /etc/passwd
$ podman start -l
$ podman logs -l
Gives a different and proper result:
bmenant:*:1003:1003:Benjamin Menant:/:/bin/sh
The text was updated successfully, but these errors were encountered: