-
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
Permission denied in .local when using --userns=keep-id #23369
Comments
What are the permissions on $HOME? @giuseppe this feels familiar? |
|
ls -al /home ls -al /home/user/.local
It is xfs on an lvm volume.
Oops, what I said was wrong. We only want to retain the username and ensure rootless in the container. User ID can (and does) change. |
If you chmod 701 /home/user /home/user/.local does it make it better? |
After running Result of podman run is the same: |
Something I should add: When we Edit: Also if it helps, this is reproducible on three identical systems running stock RHEL 9.4. |
I would just do a Something is strange about your laptop. We are not seeing this anywhere else. |
Hmmm restorecon also results in permission denied:
podman system reset also has permission denied:
I think it is interesting that whatever checks file/user/group permissions is seemingly not considering the subuid/subgid ownership. Any insight on this? |
|
I am surprised |
|
Looking around, I'll check on |
I would do sudo chown -R UID:GID /home/user/.local/share/containers |
Turns out, RHEL does not support this feature. |
After these, my user seems to work well. I will tell my team to do this and verify that it works for everyone before closing this issue. |
how have you created these files? Was the storage copied from another system as root? |
No, these files were created from a |
How are additional IDs configured for the users on the system? Statically in |
Statically via /etc/subuid and /etc/subgid. In practice, we have a script that is run by a cronjob every 30 seconds that reads /etc/passwd and generates a new /set/sub?id. As long as the order in /etc/passwd is preserved, the mappings should stay constant. Although I can see how that would cause an issue. But wouldn't a call to |
if these ids change, then the files in the local storage are stored with the wrong ownership, causing the issue you had |
Ok this makes a lot of sense. It looks people are able to recover by doing a |
Issue Description
Our use-case for podman is containerizing a production development environment. We want each developer to be able to use a container as if it were the bare-metal development system. The way we accomplish this is using the
--userns=keep-id
option on podman run, but some developers run into the problem where podman cannot access image layers (getting permission denied).Steps to reproduce the issue
Steps to reproduce the issue
podman run --pids-limit=0 -d -i -t --init --privileged --userns=keep-id --env HOME=$HOME --env SHELL=$SHELL --group-add=mock <image>
Describe the results you received
Error: creating container storage: creating read-write layer with ID "b4a6726d5bcc53585a3bd1a265877ce50b743a6db23a9c2914a4349f30762112": Stat /home/<user>/.local/share/containers/storage/overlay/93db864845d68b98ad858b4917496543786da7bdd29a0dd1885907401cd29b00/diff: permission denied
Describe the results you expected
A podman container up and running that can be
exec
'd into.podman info output
Podman in a container
No
Privileged Or Rootless
Rootless
Upstream Latest Release
Yes
Additional environment details
ls -al /home/<user>/.local/share/containers/storage/overlay
drwx------. 5 576608 576608 92 Jun 26 17:16 93db864845d68b98ad858b4917496543786da7bdd29a0dd1885907401cd29b00
<user>:493216:65536
Additional information
Removing
--userns=keepid
allows the container to run, but drops the user in as "root", which is undesirable. The ideal case allows each user to retain their user-id and username for tooling purposes.SELinux is set to enforcing, but the behavior does not change when SELinux is switched to permissive.
The text was updated successfully, but these errors were encountered: