Mounting /home read-write
Allowing LXD to remap your user ID
The first step for that is to allow LXD to remap your user ID. Remember, LXD uses linux namespaces to isolate processes, and by default even root is not allowed to reuse UIDs from the host inside containers.
We want to allow the LXD demon (running as root) to remap our host's user ID inside a container:
Note: $UID is likely to be 1000 on an Ubuntu system if you're the only user.
echo "root:$UID:1" | sudo tee -a /etc/subuid /etc/subgid
This is a one time step, you'll never need to do this again on your host.
Remapping your user ID inside the container
Once LXD is allowed to remap your UID, we need to actually tell it to do it on a per-container basis:
lxd init ubuntu-daily:z remapped
lxc config set remapped raw.idmap "both $UID 1000"
There is a little bit of magic-looking syntax there, but "both $UID 1000" simply means "map both the UID and the GID, from the host's $UID to the guest's 1000".
We could instead set "uid $UID 1000" and "gid $(id -g) 1000" to be more explicit, but the "both" syntax is convenient.