DiyMediaServer
Featured image of post LXC UID/GID Mapping Tool

LXC UID/GID Mapping Tool

Generate lxc.idmap lines entries for unprivileged Proxmox LXC containers.

Enter the UIDs and GIDs you want to pass through from the host into your LXC container. The tool generates the lxc.idmap block for your container config, the /etc/subuid and /etc/subgid entries needed on the Proxmox host.

Container settings

The numeric ID of your LXC container, e.g. 101.

Comma-separated user IDs you want to share with the container. Find with id <username> on the host.

Often the same numbers as the UIDs above. Find with id <username> on the host.

Container mode

Privileged containers share host UIDs/GIDs directly — no lxc.idmap or subuid changes are needed. Only a host chown is required.

/etc/pve/lxc/<CTID>.conf
Enter a CTID and UID(s) to generate idmap lines.
/etc/subuid + /etc/subgid
Enter a CTID and UID(s) to generate subuid/subgid lines.

Finding IDs on the Proxmox Host

Run these commands in a Proxmox host shell to find the UID and GID you need:

# Your current user
id

# A specific service user (e.g. jellyfin, www-data)
id jellyfin

# Look up a user by name in the full user database
getent passwd jellyfin

The output looks like uid=1000(jellyfin) gid=1000(jellyfin) groups=.... The number after uid= is the UID; the number after gid= is the primary GID. Enter those numbers into the tool above.

Finding IDs inside the LXC Container

Run these commands from the Proxmox host to query IDs inside a running container (replace 101 with your CTID):

# Look up a user inside the container
pct exec 101 -- id jellyfin

# Check what uid_map the container is using
pct exec 101 -- cat /proc/self/uid_map

# Or enter the container shell directly
pct enter 101
id jellyfin

The id output inside the container shows the LXC-side IDs — these are what go into the lxc.idmap lines. The Proxmox host sees the mapped host IDs instead.