On 4/26/22 01:40, Giuseppe Scrivano wrote:
R C <cjvijf(a)gmail.com> writes:
> On 4/25/22 12:47, Daniel Walsh wrote:
>> On 4/24/22 18:36, R C wrote:
>>> I built a container that mounts the /home directy (it has one
>>> unprivileged user).
>>> (I used buildah and podman on that unprivileged account, using rhel8)
>>> However when I connect to the container, I see that the
>>> unprivileged user's home directory is owned by root.
>>> any idea why that would be, I am probably missing something
>>> Podman mailing list -- podman(a)lists.podman.io
>>> To unsubscribe send an email to podman-leave(a)lists.podman.io
>> Please show the actually podman command you are executing to see
>> this issue, also give the output of podman info
> I probably have to change something with namespaces or so:
> $ podman run -it --rm --name=home-fs -v $HOME:$HOME -v /mnt:/mnt -u
> myuid localhost/home-fs
> bash: /home/myuid/.bashrc: Permission denied
> [rocr@containers ~]$ podman run -it --rm --name=home-fs -v $HOME:$HOME
> -v /mnt:/mnt localhost/home-fs
> [root@b82256bb2424 myuid]#
the rootless container is running in a user namespace where root in the
container is mapped to your UID on the host.
You are probably looking for the `--userns keep-id` option:
$ podman run -it --rm --userns keep-id --name=home-fs -v $HOME:$HOME -v /mnt:/mnt
thanks! that worked.
I'll check that out (I was a little surprised that everything in that
container is owned by that uid)