How to create different security mappings for different containers on the host?

pedroc88

New Member
Jul 23, 2025
2
0
1
TL;DR

How can I map the first user of each container to a different user in the host? My understanding is that the first user of each container is 1000 and it maps to a user 101000 in the host but, if I grant permissions to user 101000 on a host resource, both users on the two containers would get it, and I want to prevent this. What is the proper way of doing this?

What have I tried?

I updated these files (assuming containers 101 and 102)
> /etc/pve/lxc/101.conf
lxc.idmap = u 0 10100000 65536
lxc.idmap = g 0 10100000 65536

> /etc/pve/lxc/102.conf
lxc.idmap = u 0 10200000 65536
lxc.idmap = g 0 10200000 65536

> /etc/subuid
root:10100000:65536
root:10200000:65536

> /etc/subgid
root:10100000:65536
root:10200000:65536
But when I enter the container, I get this error bash: /root/.bashrc: Permission denied and things don't work as expected.