Valid LXC UID mapping makes Guest /home folder owned by nobody

poisonborz

Member
May 8, 2020
25
2
23
55
I'm trying to do a very typical uid mapping. I have both a Guest and Host user id 5000.
Just for reference I'm adding my config, it is valid, because it works. I see Bind mount files on Guest/Host owned by #5000 user as their respective users in Guest/Host.

Code:
lxc.idmap: u 0 100000 5000
lxc.idmap: g 0 100000 5000
lxc.idmap: u 5000 5000 1
lxc.idmap: g 5000 5000 1
lxc.idmap: u 5001 105001 60535
lxc.idmap: g 5001 105001 60535

// sub{g,u}id
root:100000:65536
root:5000:1

BUT. When the mapping is added, the /home folder of #5000 on the Guest is suddenly being owned by 65534/nobody. What could be the possible issue?

I tried the same with multiple container templates (Turnkey, Alpine) with same results...
 
Just a sidenote, I circumvented this issue, without UID mapping.

As stated in OP, I just wanted to share Bind mounts between containers, without the possibility that files are unavailable or read only to some containers. This doesn't necessitate specific users, just preset rights. So I added 777 ACL-s to the root folders on the Host - it's not a problem security wise, as containers only get the bind mounts they should have full access to.

For anyone with the same problem, think about if you are truly needing a specific user to own the files - if not, ACL is a good, and much simpler solution. I still wish I knew what the issue was with the UID mapping, but for now, it was not needed.
 
Last edited: