Why bother with user remapping on LXC / Host?

gelcom

Member
Mar 18, 2021
32
0
11
44
Hi all, I need a LXC container to access with read/write permissions a specific directory on proxmox host.

According to Proxmox WiKi I can accomplish that by remapping a LXC user to a host user but I'm unsure of why to do that if I can simply grant access to LXC user without remapping (eg. grant acess on host to user 100001 / group 100001).


What am I missing here?


sorry for the noob question...

kind regards
 
Last edited:
You can do that if you are fine with files/folders being owned by 100001. But often you need files to be owned by a specific user. Lets say for example you run a webserver on the host as user www-data with UID/GID 33 and you also want to bind-mount those files into a LXC. If you keep 33 as the owner your LXC can't access it. If you change the owner to 100033 on the host your webserver won't work anymore as the hosts user 33 can't access it anymore but now the LXc user 33 inside the LXC could access it.
Solution would be to edit the user remapping so UID 33 on the host is the same as UID 33 inside the guest. Then UID 33 on the host and UID 33 inside the guest could access the same data.
 

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!