Access NEXTCLOUD_DATADIR folder via NFS

I have two PI4, one runnning the docer version of Nextcloud (V24.0.6) and another running Photoprism. I would like the Photoprism PI to mount the nc data directory on the PI4 running nextcloud. Both Nextcloud and Photoprism is working fine and I can upload files via web wihout any problems. The nc data folder is placed on the host and not in the docker container.

I have enabled NFS server on Nextcloud server and configured /etc/exports with the path to the nc data folder - more precisely the Photos folder. When I try to mount this NFS share on the other PI4 running Photoprism I get an error: “aacess denied by server while mounting…”

The nc data folders are “owned” by www-data and I can’t figure how I either can use www-data as a user to access the share or give other users permission to access the same folders and files like www-data.

When I installed the docker version of Nextcloud I set the parameter:
“-e NEXTCLOUD_DATADIR=”/mnt/ncdata"
All foldes and files from ncdata is owned by www-data and I have to “sudo -i” to access it from a terminal.

Bad idea. Don’t mess with the data folder.

don’t mess with the data on the filesystem. Instead use native interfaces e.g. WebDAV or nextcloudcmd

1 Like

Thanks for the advice, what will you recommend instead ? I guess it must be a quite common use case to share all of your Nextcloud files with other applications like Photoprism ? also cross several servers in the network.

BTW - I only need read access to ncdata from my photoprism server = only use nc clients + web to upload docs and photos

(not done it myself but) there is davfs, that allows you to mount WebDAV as filesystem on a Linux system.

Photoprism can connect directly to WebDAV servers such as Nextcloud… Sync - PhotoPrism

1 Like

I have now setup Photoprism to use webdav to the Nextcloud server. But Photoprism uses webdav to synchronize with the Nextcloud server and I only want my originals files (15k photos) on the nextcloud server. So basically I only want Photoprism to index the photo folder on the nextcloud server. Any ideas for that ?

  • Do you also recommend that I upload the 15k photo files via webdav to my nextcloud server ?

First of all, I don’t use Photoprism myself, so I didn’t know that only a full file sync is possible via WebDAV.

I’m not entirely sure how I would proceed here, but I would probably try to keep Nextcloud out of the equation and upload my photos directly to Photoprism: https://docs.photoprism.app. Or maybe it’s possible to use Photoprism’s WebDAV client for an automated one-way sync from Nextcloud to Photoprism. In both cases, Photoprism would then be the primary storage for your photos, which would simplify things a lot.

However, it’s of course not impossible to access the Nextcloud data directory directly. Also the statement “Don’t mess with your Data Directory” is more like a general rule of thumb than a strict rule. But I mostly agree with that statement. The main reason why you should avoid doing that, would be potential security risks. Another reason would be that Nextcloud will not recognize any changes you made directly to data folder until you trigger a manual re-scan.

Thank you very much for your comment and input - really appreciate it. I will wait making the final decision until I have tested the new Nextcloud Photo app - after what I can read it might be an alternative to Photoprism.

Did you have any suggestion on how to copy/bootstrap the 15k photos into Nextcloud ? via webdav ?