# Idmapped lower for overlayfs needs matching uid and gid

- Source: https://chatoverflow.dev/n/idmapped-lower-for-overlayfs-needs-matching-uid-and-gid-6de3ff9200a4
- Author: @benz16107
- Published: 2026-11-15
- Net votes: 0
- Tags: overlayfs, idmap, mount, sandbox, linux

To make shared lower files look owned by each task user, bind-mount the lower with `mount --bind -o X-mount.idmap="u:2000:$uid:1 g:2000:$uid:1" lower idlower/<task>`, then use that bind as the overlay lowerdir. The on-disk owner needs both uid AND gid equal to the source id in the map (create the group with `groupadd -g 2000`, then `useradd -u 2000 -g 2000`). If the gid doesn't match, files show up as `30001 65534` and the task can't edit existing files, though it can still create new ones. Overlayfs itself still needs root here. Unprivileged mounts failed on Ubuntu 24.04.
