Problem with uids and permissions #12970
-
Description Important thing: this application is not running as root insider the container To do that, we are using follwing command The folder on host has following owner/permissions before the container is started After the application is started, we see following on the folder The uid/gid 495218 is almost clear as
As "expected" I can't access the folder, UID/GID on host is 1024.
I need to access the folder content. What I want to know is, how can I ensure that the access on the folder from host and container is possible? Output of `podman info:
|
Beta Was this translation helpful? Give feedback.
Replies: 13 comments 11 replies
-
I think It runs a shell inside the rootless Podman user namespace, so it runs as root (inside the user namespace) and you have access to all the files created/owned by rootless containers |
Beta Was this translation helpful? Give feedback.
-
i.e. |
Beta Was this translation helpful? Give feedback.
-
I agree that with
also I was able to use
Is that really the one and only way to get access to the content of the folder? I think also about log monitoring for example. We Use splunk which needs to get access to the log file. |
Beta Was this translation helpful? Give feedback.
-
@Joerg-L By using --uidmap and --gidmap the created files will be owned by your normal user.
Regarding the use of UID and GID 2003 I wrote something here |
Beta Was this translation helpful? Give feedback.
-
I accidentally added
It works without it too. |
Beta Was this translation helpful? Give feedback.
-
Many thanks @eriksjolund that's really helpfull and work fine. correct me please, if I'm wrong, but I can also put that mapping into storage.conf related to |
Beta Was this translation helpful? Give feedback.
-
I see an option related to remapping UIDs in
but we made use of a mapping to treat UID 2003 and GID 2003 in a special way. That is very specific to this container image so it should probably be specified on the command-line. I wonder if it would make sense to abbreviate this style of mapping:
into a new command-line option (name? maybe --mapped-user=$uid:$gid or something else). |
Beta Was this translation helpful? Give feedback.
-
That would make things definetly easier..... We found our way to podman, comming from docker, to getting rootless. Getting aware of that issue, if files in container, which were not create bei container root, needs such "big" logic was really surprising. |
Beta Was this translation helpful? Give feedback.
-
Theoretically Podman could check after the container has finished executing that there are no files owned by subordinate UIDs in any of the bind-mounted directories. If Podman would only find such files, Podman could automatically compute the $uid and $gid value for --mapped-user= and suggest it to the user. (Just a wild idea, probably a bit too wild) |
Beta Was this translation helpful? Give feedback.
-
Could you try if Outside of the user namespace your user has no capabilities and doesn't have access to files readable only to other users. |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
This feels like a discussion rather then an issue. |
Beta Was this translation helpful? Give feedback.
-
@eriksjolund @giuseppe On more question on that: Can this be also used together with a pod? So for clarification: |
Beta Was this translation helpful? Give feedback.
@Joerg-L By using --uidmap and --gidmap the created files will be owned by your normal user.
I tried it out and it seems to work: