Imagine two applications running on the same Ubuntu server. Emailwiz runs under a host account called mail-user, and a web app runs under web-user. Both applications use UID 1000 inside their containers. On the host, those processes show up under different UIDs.
Linux user namespaces make this possible. Each namespace defines how the user IDs (UIDs) and group IDs (GIDs) seen inside a container translate to IDs on the host. Podman run documentation
1. Create the host service accounts
On Ubuntu 24.04 with Podman and uidmap installed, create a separate service account for each application.
for account in mail-user web-user; do sudo useradd --system --create-home --user-group \ --shell /usr/sbin/nologin --add-subids-for-system "$account" done Each account gets its own host UID, primary GID, and home directory. The --add-subids-for-system flag also allocates subordinate UID and GID ranges that rootless Podman can use. With Ubuntu’s defaults, useradd finds an available block of 65,536 UIDs and a separate block of 65,536 GIDs for each account. Ubuntu useradd manual
2. Check what the host assigned
for account in mail-user web-user; do id "$account" getsubids "$account" getsubids -g "$account" done id shows the account’s own UID and GID. getsubids shows the start and length of its subordinate UID range. Add -g to see the subordinate GID range. One host might look like this. Ubuntu getsubids manual
| Host account | Own UID:GID | Subordinate UIDs | Subordinate GIDs |
|---|---|---|---|
mail-user | 980:980 | 100000–165535 | 100000–165535 |
web-user | 981:981 | 165536–231071 | 165536–231071 |
The exact numbers depend on the host. UID and GID ranges are allocated independently, so their starting values can differ.
3. Work out the container IDs and their limits
With the default rootless mapping, Podman maps container 0:0 to the host account’s own UID and primary GID. Starting at container 1:1, it uses the subordinate ranges in order. Here’s how the example above maps. Podman rootless mapping guide
| Container UID:GID | Host IDs under mail-user | Host IDs under web-user |
|---|---|---|
0:0 | 980:980 | 981:981 |
1:1 | 100000:100000 | 165536:165536 |
1000:1000 | 100999:100999 | 166535:166535 |
65536:65536 | 165535:165535 | 231071:231071 |
In this example, the highest usable UID and GID inside either container is 65536. The subordinate ranges cover 1 through 65536, and the host account’s own IDs cover 0. That gives the container 65,537 mapped UID values and 65,537 mapped GID values. A process can run as 65536:65536, while a request to start it as 65537:65537 falls outside this mapping.
Containers launched by the same host account in the default mode reuse its ranges. If you choose a different user namespace mode or configure a custom mapping, check the container’s uid_map and gid_map to see which IDs are available. Podman user namespace modes · Linux user namespaces
4. See the mapping from inside each container
For a rootless Quadlet deployment, enable lingering so each account’s systemd user manager starts at boot, even without a login session. Then run the same image as 1000:1000 under both accounts to see the difference. systemd loginctl · Podman Quadlet
sudo loginctl enable-linger mail-user web-user for account in mail-user web-user; do printf '\n%s\n' "$account" sudo -H -u "$account" env XDG_RUNTIME_DIR="/run/user/$(id -u "$account")" \ podman run --rm --user 1000:1000 docker.io/library/alpine \ sh -c 'id && cat /proc/self/uid_map && cat /proc/self/gid_map' done Both runs report UID 1000 and GID 1000 inside the container. The mapping tables show where those IDs land on the host. Read each row as first container ID, first host ID, number of IDs. For mail-user, the row 1 100000 65536 starts at container UID 1 and covers 65,536 values, so it ends at 1 + 65536 − 1 = 65536. Linux uid_map and gid_map
What this means for persistent files
Suppose Emailwiz’s mailbox owner mehmet uses 1000:1000 inside the container. When Dovecot writes to a persistent Maildir under the mapping above, the host records the owner as 100999:100999. Recreating the container with the same volume and mapping preserves Dovecot’s access.
An existing host directory is where this distinction matters most. If the host’s own mehmet account owns /home/mehmet/Mail as 1000:1000, the container’s mehmet reaches it as 100999:100999. Before bind-mounting an existing Maildir, check its numeric ownership and permissions against the container’s mapping. Podman volume permission examples