[SOLVED] permissions over files created by LXC container

pharpe

Member
Jul 15, 2020
38
1
13
51
I'm having trouble figuring out how to set permissions to edit and delete files created by an LXC container. On my host I have a user named tom. I want to allow that user to delete and edit files created by user 101000. Here is an example file

Code:
-rw-rw-r--   1 101000 101000  473054718 Nov  9 02:54 test_file

I tried to add tom to the 101000 group on the host but it does not exist. From what I'm reading there is some type of mapping between the LXC and the host but I can't quite wrap my head around it.
 
LXCs and hosts groups aren't the same. And the user with uid 1000 inside your LXC is for example mapped to user 101000 on your host.
Look here how to change the user/group mapping.
You need to manually map a user so that this user got the same UID on the host and in the LXC.

So basically...
1.) create a user "tom" with uid 1005 on your host
2.) create a user "tom" with uid 1005 on your LXC
3.) bind-mount the folder you want to share from your host to your LXC
4.) edit the config files "/etc/pve/lxc/IdNrOfYourLxc.conf", "/etc/subuid" and "/etc/subgid" like the linked wiki article.

You can use any uid/gid you want, but if it is not 1005 you need to calculate the right new numbers and you can't just follow the instructions.
 
Last edited:
  • Like
Reactions: pharpe

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!