lxc mountpoint mapping existing uid,gid to another internal id

Kodey

Member
Oct 26, 2021
124
6
23
I have a unprivileged container running a media server and the rootfs is local-btrfs.
The media server runs as uid 107 inside the container but I'm not sure if that maps to an external uid
A zfs media disk with uid 101001 on the host has 700 access permissions
I want to map this to the container to the media server can read the mounted zfs.

I'm not sure what uid I need to map the mountpoint 101001 to in the container conf file.
Any help is welcome
 
Is there a way to see the container fs from the host's perspective like zfs has a default mountpoint but I can't find btrfs mountpoint?
 
So I mounted like this and of course (unlike zfs) there is no correlation between the host and the guest container:
Code:
root@pmhost:~# losetup /dev/loop22 /var/lib/pve/local-btrfs/images/108/vm-108-disk-0/disk.raw
root@pmhost:~# mount -o ro,defaults,noatime /dev/loop22 /mnt/tmp
I'm hopeful from what I've read I can work out the uid mapping. More to come
 
Code:
pct mount <ID>
cd /var/lib/lxc/<ID>/rootfs
chown <UID on host>:<GID on host> -R path/to/dir other/file
cd
pct unmount <ID>
found here
https://forum.proxmox.com/threads/problems-using-a-mount-point-and-lxc-idmap.77370/post-348839
This is a much better method of looking into the container mount.
I can see the mountpoint and it's ids and I can mount while it's running

Struggling with the correct syntax for mapping uids.
This is probably not what I want and won't work judging by the implementation.
I realise it was wrong when I said there was no correlation.
I'd want 2 host uids to map to the same guest uid and these mappings look 1:1