Wrong file ownership in rootless container export created with --userns=keep-id
Author: koalatuxCreated Sep 29, 2026Updated Sep 30, 2026
Labelskind/bug
Issue Description
When running podman export ... on a rootless container which has been created by podman create --userns=keep-id ... the file ownerships in the exported tarball are not as one would expect.
Steps to reproduce the issue
The script below reproduces the bug, at the end it shows an expected and an actual file listing:
#!/bin/bash
podman build -t test - << EOF
FROM debian:13-slim
RUN useradd -m user
EOF
echo -e "\nls in container:\n"
podman run --rm test ls -lan /home/user
echo -e "\nregular export (expected):\n"
cid1=$(podman create test)
podman export "$cid1" | tar tv home
echo -e "\nexport with create --userns=keep-id (actual):\n"
cid2=$(podman create --userns=keep-id test)
podman export "$cid2" | tar tv homeTrunacted output:
ls in container:
total 20
drwx------ 2 1000 1000 4096 Sep 29 13:55 .
drwxr-xr-x 1 0 0 4096 Sep 29 13:55 ..
-rw-r--r-- 1 1000 1000 220 Jul 12 16:58 .bash_logout
-rw-r--r-- 1 1000 1000 3526 Jul 12 16:58 .bashrc
-rw-r--r-- 1 1000 1000 807 Jul 12 16:58 .profile
regular export (expected):
drwxr-xr-x 0/0 0 2026-09-29 13:55 home/
drwx------ 1000/1000 0 2026-09-29 13:55 home/user/
-rw-r--r-- 1000/1000 220 2026-07-12 16:58 home/user/.bash_logout
-rw-r--r-- 1000/1000 3526 2026-07-12 16:58 home/user/.bashrc
-rw-r--r-- 1000/1000 807 2026-07-12 16:58 home/user/.profile
export with create --userns=keep-id (actual):
drwxr-xr-x 1/1 0 2026-09-29 13:55 home/
drwx------ 0/0 0 2026-09-29 13:55 home/user/
-rw-r--r-- 0/0 220 2026-07-12 16:58 home/user/.bash_logout
-rw-r--r-- 0/0 3526 2026-07-12 16:58 home/user/.bashrc
-rw-r--r-- 0/0 807 2026-07-12 16:58 home/user/.profileDescribe the results you received
Files owned by UID 1000 inside the container get exported to the tarball as owned by UID 0.
Describe the results you expected
Files owned by UID 1000 inside the container get exported to the tarball as owned by UID 1000.
podman info output
host:
arch: amd64
buildahVersion: 1.43.4
cgroupControllers:
- memory
- pids
cgroupManager: cgroupfs
cgroupVersion: v2
conmon:
package: conmon-2.2.1-2.fc44.x86_64
path: /usr/bin/conmon
version: 'conmon version 2.2.1, commit: '
cpuUtilization:
idlePercent: 95.82
systemPercent: 1.33
userPercent: 2.85
cpus: 4
databaseBackend: sqlite
distribution:
distribution: fedora
variant: container
version: "44"
eventLogger: file
freeLocks: 2048
hostname: cbb472ded1f7
idMappings:
gidmap:
- container_id: 0
host_id: 1000
size: 1
- container_id: 1
host_id: 1
size: 999
- container_id: 1000
host_id: 1001
size: 64535
uidmap:
- container_id: 0
host_id: 1000
size: 1
- container_id: 1
host_id: 1
size: 999
- container_id: 1000
host_id: 1001
size: 64535
kernel: 4.18.0-553.156.1.el8_10.x86_64
linkmode: dynamic
logDriver: k8s-file
memFree: 5691580416
memTotal: 66959568896
networkBackend: netavark
networkBackendInfo:
backend: netavark
defaultNetwork: podman
dns:
package: aardvark-dns-1.17.1-1.fc44.x86_64
path: /usr/libexec/podman/aardvark-dns
version: aardvark-dns 1.17.1
package: netavark-1.17.2-1.fc44.x86_64
path: /usr/libexec/podman/netavark
version: netavark 1.17.2
ociRuntime:
name: crun
package: crun-1.28-1.fc44.x86_64
path: /usr/bin/crun
version: |-
crun version 1.28
commit: 54f16ffbefcd022bf032af768b5c5ce075c18bfc
rundir: /tmp/storage-run-1000/crun
spec: 1.0.0
+SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +LIBKRUN +WASM:wasmedge +JSON_C
os: linux
pasta:
executable: /usr/bin/pasta
package: passt-0^20260728.gf8df3f1-2.fc44.x86_64
version: |
pasta 0^20260728.gf8df3f1-2.fc44.x86_64
Copyright Red Hat
GNU General Public License, version 2 or later
<https://www.gnu.org/licenses/old-licenses/gpl-2.0.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
remoteSocket:
exists: true
path: /tmp/storage-run-1000/podman/podman.sock
rootlessNetworkCmd: pasta
security:
apparmorEnabled: false
capabilities: CAP_CHOWN,CAP_DAC_OVERRIDE,CAP_FOWNER,CAP_FSETID,CAP_KILL,CAP_NET_BIND_SERVICE,CAP_SETFCAP,CAP_SETGID,CAP_SETPCAP,CAP_SETUID,CAP_SYS_CHROOT
rootless: true
seccompEnabled: true
seccompProfilePath: /usr/share/containers/seccomp.json
selinuxEnabled: false
serviceIsRemote: false
slirp4netns:
executable: ""
package: ""
version: ""
swapFree: 10735054848
swapTotal: 10737414144
uptime: 359h 17m 19.00s (Approximately 14.96 days)
variant: ""
plugins:
authorization: null
log:
- k8s-file
- none
- passthrough
- journald
network:
- bridge
- macvlan
- ipvlan
volume:
- local
registries:
search:
- registry.fedoraproject.org
- registry.access.redhat.com
- docker.io
store:
configFile: /home/user/.config/containers/storage.conf
containerStore:
number: 0
paused: 0
running: 0
stopped: 0
graphDriverName: overlay
graphOptions: {}
graphRoot: /home/user/.local/share/containers/storage
graphRootAllocated: 1010970918912
graphRootUsed: 608168468480
graphStatus:
Backing Filesystem: xfs
Native Overlay Diff: "true"
Supports d_type: "true"
Supports shifting: "false"
Supports volatile: "true"
Using metacopy: "false"
imageCopyTmpDir: /var/tmp
imageStore:
number: 0
runRoot: /tmp/storage-run-1000/containers
transientStore: false
volumePath: /home/user/.local/share/containers/storage/volumes
version:
APIVersion: 5.8.7
BuildOrigin: Fedora Project
Built: 1789516800
BuiltTime: Wed Sep 16 00:00:00 2026
GitCommit: c593b672bf3db1173aebea565ebf1a724ea196dc
GoVersion: go1.26.8-X:nodwarf5
Os: linux
OsArch: linux/amd64
Version: 5.8.7Podman in a container
Yes
Privileged Or Rootless
Rootless
Upstream Latest Release
Yes
Additional environment details
No response
Additional information
No response
Source: podman-container-tools/podman