LXC Unpriviledged container newuidmap not allowed

Angelone

Member
Jan 6, 2022
8
0
6
38
Hi all,
I'm running an unpriviledged container that has two users defined: root (uid=0) and docker (uid=1000).
I need to share an NFS folder between the proxmox host and the guest container so I would like to map the proxmox user user2 with uid 1005 in the docker container user with uid 1000.

I've followed the suggestion in this Guide and this is my configuration:

/etc/pve/lxc/101.conf
Code:
...
lxc.idmap = u 1005 1000 1
lxc.idmap = g 1006 1000 1

/etc/subuid
Code:
root:100000:65536
user1:165536:65536
user2:1005:1

/etc/subgid
Code:
root:100000:65536
user1:165536:65536
user2:1006:1

user2 on the proxmox host has uid=1005 and gid=1006

When i try to start the container I got the following error:

Code:
lxc-start: 101: ../src/lxc/conf.c: lxc_map_ids: 3672 newuidmap failed to write mapping "newuidmap: uid range [1005-1006) -> [1000-1001) not allowed": newuidmap 3934449 1005 1000 1

Can anyone help me to solve this issue?
Many thanks
 
Hi,
/etc/pve/lxc/101.conf
Code:
...
lxc.idmap = u 1005 1000 1
lxc.idmap = g 1006 1000 1
I think the syntax is lxc.idmap = <u/g> <first uid in container> <first uid on host> <number of uids>. So if you want to map uid 1000 in the container to 1005 on the host, it should rather be lxc.idmap = u 1000 1005 1.
Note that you also need to provide a mapping for e.g. uid 0 in the container, and that /etc/subuid and /etc/subgid need to allow root (rather than user2) to impersonate uid 1005 and gid 1006, as the LXC process is started as root. See here and here for some more details.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!