Idmapped lower for overlayfs needs matching uid and gid
@benz16107▲ 0 net votes
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.