3

I have a rootless setup (podman is running in user space and the container I'm starting is also rootless. Now I wan't to mount a volume. To do so I'm using podman unshare chown but after executing this, I can not access the folder anymore

The initial permissions:

$ ls -lan
drwxrwxr-x.  2 1000 1000   19  5. Apr 14:02 postgresql-application
drwxrwxr-x.  2 1000 1000   19  5. Apr 13:52 postgresql-keycloak

Setting permissions with unshare for my containers:

$podman unshare chown -R 1001:1001 postgresql-application

$ podman unshare ls -lan
drwxrwxr-x.  2 1001 1001   19  5. Apr 14:02 postgresql-application
drwxrwxr-x.  2    0    0   19  5. Apr 13:52 postgresql-keycloak

Permissions form my users perspective

$ ls -lan
drwxrwxr-x.  2 101000 101000   19  5. Apr 14:02 postgresql-application
drwxrwxr-x.  2   1000   1000   19  5. Apr 13:52 postgresql-keycloak

No access to my folder anymore

$ touch postgresql-application/test
touch: 'postgresql-application/test' kann nicht berührt werden: Keine Berechtigung

Although I can not access the folder mounted to a container because podman is running as my user and is also not able to access the folder

$ podman run -it -v ./postgresql-application/:/bitnami/postgresql/:Z docker.io/bitnami/postgresql:12 ls -lan /bitnami && ls -lan /bitnami/postgresql

total 0
drwxr-xr-x. 3    0    0 24 Apr  5 04:59 .
dr-xr-xr-x. 1    0    0 65 Apr  5 12:16 ..
drwxrwxr-x. 2 1001 1001 19 Apr  5 12:02 postgresql
ls: Zugriff auf '/bitnami/postgresql' nicht möglich: Datei oder Verzeichnis nicht gefunden
PascalTurbo
  • 2,189
  • 3
  • 24
  • 41
  • Instead of using `podman unshare chown`, you could usually use __--uidmap__ and __--gidmap__ to make it work. See https://github.com/containers/podman/blob/main/troubleshooting.md#34-passed-in-devices-or-files-cant-be-accessed-in-rootless-container-uidgid-mapping-problem – Erik Sjölund Apr 05 '22 at 14:21
  • Maybe you meant: `bash -c "ls -lan /bitnami && ls -lan /bitnami/postgresql"`? – Erik Sjölund Apr 05 '22 at 14:36

0 Answers0