clone: Operation not permitted when creating user namespace in rootless Podman
0 reputation · 11 Aug 2026, 23:14 UTC
0 reputation · 11 Aug 2026, 23:14 UTC
Goal: achieve a repeatable development environment that relies on rootless containers (e.g., Podman, bubblewrap) and works identically on any Linux host, regardless of distribution‑specific user namespace settings.
Constraints: on Debian/Ubuntu the kernel.unprivileged_userns_clone sysctl may be set to 0, while Ubuntu 23.10+ enforces AppArmor restrictions on unprivileged userns; the kernel knob user.max_user_namespaces can also cap namespace creation per user. Enabling unprivileged user namespaces improves usability but historically widens the local privilege‑escalation attack surface, whereas restricting them forces reliance on setuid helpers such as newuidmap/newgidmap, which may not provide the same level of isolation for all sandboxing tools.
Questions: What are the security trade‑offs of enabling unprivileged user namespaces globally on a multi‑user system? How can administrators confirm that setuid helpers provide equivalent isolation without introducing new risks? Is there a policy (e.g., per‑user namespace limits or conditional AppArmor profiles) that balances repeatable usability with acceptable security?
34775 reputation · 12 Aug 2026, 10:58 UTC
Rootless Podman fails with clone: Operation not permitted when the kernel either blocks unprivileged namespace creation ( kernel.unprivileged_userns_clone=0 ), the per‑user namespace limit is exhausted, or AppArmor forbids the binary from creating a user namespace. Enabling kernel.unprivileged_userns_clone=1 globally widens the attack surface for local privilege escalation, but it restores the most straightforward rootless workflow. Administrators can keep the kernel knob at 0 and rely on newuidmap/newgidmap helpers (setuid binaries) to provide equivalent isolation, provided the helpers have the setuid bit set and the /etc/subuid and /etc/subgid files are correctly configured.
podman run without additional UID mapping configuration.ls -l /usr/bin/newuidmap /usr/bin/newgidmap
# Expected: -rwsr-xr-x 1 root root …
grep ^$(id -un): /etc/subuid
grep ^$(id -un): /etc/subgid
podman run --rm -ti --entrypoint sh alpine -c "id; ls -l /proc/self/ns/user"
# You should see a non‑root UID and a distinct user namespace link.
journalctl -k | grep -i apparmor | grep userns_create
kernel.unprivileged_userns_clone=0 to minimise kernel exposure.sysctl -w user.max_user_namespaces=64
# Persist in /etc/sysctl.d/99-userns.conf
profile podman {
capability setuid,
capability setgid,
/usr/bin/podman mr,
/usr/bin/newuidmap mr,
/usr/bin/newgidmap mr,
/etc/subuid r,
/etc/subgid r,
/usr/share/podman/* r,
}
/etc/subuid and /etc/subgid regularly to ensure ranges are not over‑committed.podman system reset --rootless to clean stale namespace entries if a user’s namespace quota is exhausted.Could you confirm the current value of user.max_user_namespaces on the target system? This will determine whether the per‑user limit is the cause of the clone failure and whether the policy above needs tightening.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.