Shared Host Directory Permission Issues

Hi there, I’m new to using LXD so please bear with me if this question has already been answered or is very simple.

I’ve been trying to set up a shared host directory between my webserver container, running NextCloud, and my host. I’ve tried

sudo chown 100000:100000 /hdd-pool/nextcloud_data
lxc config device add webserver test disk source ="/hdd-pool/nextcloud_data" path= "/nextcloud_data"

and verified through ls -l /hdd-pool that indeed uid:100000 is in fact the owner. However, when I use ls -l /nextcloud_data in the container, it says that the shared directory belongs to nobody and nogroup.

I thought maybe since hdd-pool in my environment is actually a zpool mounted to hdd-pool that maybe that would have something to do with it. To test this, I created a test directory in my home directory with similar steps from above, but same results.

I’ve already looked into the following posts:

and still don’t understand what I’m doing wrong. Am I missing something in the config or documentation? Is there a better way to go about my setup? I’d also rather not make the container a privileged one…

Thanks in advance!

Eugene Seubert

So after playing around on a sandbox on my laptop, the issue seems to be that I installed the snap package of LXD instead of the deb. Figured this out by trying the deb package instead and reading this post:

Is there a workaround to this or am I just going to have to migrate to the deb version?

The difference between the deb and the snap is what the default range is.
You chowned using 100000 which isn’t uid 0 in your container, therefore everything shows up as nobody.

Instead of assuming that it’s going to be 100000, look at what user id the container’s root process is running as, then use that instead.

1 Like

I realized that I could see what uid and gid it was using but checking the logs in /var/snap/lxd/common/lxd/logs/, and chowned it to 1000000 like it was using.

Thanks @stgraber for your help!

1 Like