"This operation is forbidden" when trying to access external storage

I am running a TrueNAS system and I already have a thread posted over there. But, in case there is someone that knows what is going with my install, here I am.

I recently installed the latest NextCloud for TrueNAS plugin (version 23.0.3). In the jail I mounted 3 datasets to /mnt/Media, /mnt/Backup, and /mnt/NextCloud. I moved the data directory for NextCloud to /mnt/NextCloud and that works great. In order to get NextCloud to be happy with the new data directory, I had to allow full control to the www user in the dataset ACL.

Now, to the other datasets, I also gave the www user full control. Then, I went to the NextCloud settings and added the datasets as external storage, with the proper paths.

The folders are visible in the interface:

image

However, whenever I click on either of the folders, I immediately get redirected to the ‘Home’ directory in NextCloud with an error message at the top right that reads “This operation is forbidden”. The logs show this:

I’m quite clueless at this point especially since the www user has full access to both of these datasets. Does anyone have any clues?

Check on the truenas forum since they use a different sort of setup. Permission questions have been asked and answered all over internet searches. Let us know if you find the answer. Here is the first result I found:

https://www.truenas.com/community/threads/unable-to-access-local-truenas-datasets-from-nextcloud.92160/

I actually managed to pinpoint the problem. It turns out that while the owner of the data directory was something other than www, the subdirectories were owned by www from when I copied it over form the original data directory. Once I recursively changed the owner to something other than www, it broke. Recursively changing the owner to www across each of the data sets is what fixed the issue.