I have the following in my container's config file:
And the following is a directory listing from my host:
So the user 1000 on my guest is mapped to the user 200101 on my host. This seems to work as expected - if I go into the guest as user 1000 and write a file to /mnt/git_repositories/test_file, that file is created and owned by user 200101 on the host. Nice!
But I also noticed that if I log into the guest as the guest's ROOT user (0), I am ALSO able to create files under /mnt/git_repositories (on the guest). Those files then show up on the host, created/owned by user 100000.
I don't understand how this works - I thought any interaction in the guest under user 0 would be mapped to activity of user 100000 on the host - yet the uid 100000 does not have any privileges on the host (in fact, that user id does not even EXIST on the host!). So how was user 100000 permitted to write files to that directory on my host? The directory on the host has permissions rwxr-x---, so only the owner (uid 200101) should be able to write to it.
Am I misunderstanding something? Or do I have something misconfigured? Thanks for any help!
Code:
unprivileged: 1
lxc.mount.entry: /tank/git_repositories mnt/git_repositories none bind 0 0
# GUEST HOST NUM
lxc.idmap: u 0 100000 1000
lxc.idmap: u 1000 200101 1
lxc.idmap: u 1001 101001 64535
lxc.idmap: g 0 100000 1000
lxc.idmap: g 1000 200101 1
lxc.idmap: g 1001 101001 64535
And the following is a directory listing from my host:
Code:
root@proxmox:# ls -al /tank/
drwxr-xr-x 5 root root 5 Dec 24 11:02 .
drwxr-xr-x 23 root root 23 Dec 19 17:51 ..
drwxr-x--- 4 200101 200101 5 Jan 17 08:45 git_repositories
So the user 1000 on my guest is mapped to the user 200101 on my host. This seems to work as expected - if I go into the guest as user 1000 and write a file to /mnt/git_repositories/test_file, that file is created and owned by user 200101 on the host. Nice!
But I also noticed that if I log into the guest as the guest's ROOT user (0), I am ALSO able to create files under /mnt/git_repositories (on the guest). Those files then show up on the host, created/owned by user 100000.
I don't understand how this works - I thought any interaction in the guest under user 0 would be mapped to activity of user 100000 on the host - yet the uid 100000 does not have any privileges on the host (in fact, that user id does not even EXIST on the host!). So how was user 100000 permitted to write files to that directory on my host? The directory on the host has permissions rwxr-x---, so only the owner (uid 200101) should be able to write to it.
Am I misunderstanding something? Or do I have something misconfigured? Thanks for any help!