If I add the appropriate comments as config items, after the container is created, then the sharing between Container and Host works fine.
$lxc config device add u5 home disk source=/home/john/shared path=/home/jradxl5/shared
$printf “uid $(id -u) 1005\ngid $(id -g) 1005” | lxc config set u5 raw.idmap
$ lxc restart u5
Remapping container filesystem
However,
if I try to add the entries into a Profile, then cloud-init carries out it’s tasks in an inconvenient order, and it does not work. (i.e, the myshared1 path is created as root) Here is an excerpt of the Profile (formating ignored)
$lxc profile show profile4
config:
security.idmap.isolated: “true”user.user-data: |
#cloud-config
users:
- default
- name: jradxl1
gecos: Jradxl1
groups: sudo
shell: /bin/bashchpasswd:
list: |
jradxl1:secret:
expire: falseraw.idmap: |-
both 1000 1001devices:
myshared1:
path: /home/jradxl1/shared
source: /home/john/shared
type: disk
Am I doing anything wrong?
Is there a better method?
lxd version 3.7, snap version