Given there is a new debian bullseye coming and QNAP will stop LXC support, I had to figure out how to do the above with an unpriviledged LXD container. Of note, the above mentioned .conf file located in /usr/local/container-station/lxc/share/lxc/config/common.conf.d/ will still be used (shared settings, not container specific) and home directories show up as intended. However, permissions will be wrong because 1) LXD has its own namespace and requires mapping and 2) QNAP's default mapping changes all UID/GID from the host system.
Here is how you can query your UID/GID mappings on command line:
Code: Select all
lxc config get <LXDCONTAINERNAME> volatile.idmap.next
And this is how you can map them:
Code: Select all
lxc config get <LXDCONTAINERNAME> volatile.idmap.next '[{"Isuid":true,"Isgid":false,"Hostid":0,"Nsid":0,"Maprange":100000000},{"Isuid":false,"Isgid":true,"Hostid":0,"Nsid":0,"Maprange":100000000}]'
Essentially, this will take host UID/GID ranging from 0-100000000 and map them to the same UID/GID in the container. You can confirm this by checking the container-specific .conf file in: /var/log/lxd/<LXDCONTAINERNAME>/lxc.conf
(Please note that you can not edit this .conf file directly as it gets overwritten at each start of the container.)