Server-side desktop sync prevention for multiple users

Dear NextCloud Community,

Is there any way to exclude a specific folder from being synced by the desktop client to the local hard drive for all users? I only know that clients can do that individually in their desktop client settings.

The use case is the following:
We are successfully using NextCloud for project work with approx. 300 users. Currently we are typing to setup a photo share for all users. Authentication should be required to access the photos share. However, as the photo share will have many hundreds of GBs in size, we’d like to prevent the “Photoshare” folder being synced to individual users. Instead, it should only be accessible through the web interface of NextCloud.

Is there any nicer way than telling users to exclude this folder from their desktop client sync?
I appreciate your support.


You could use file access control and set a filter with the user agent string:

Thank you for the hint! It works with some limitations:

  • The Desktop Clients are still downloading empty folders without the files. The files are not synced because the file access control denies access.
  • The Desktop Clients raise an error message “server reply: Forbidden” for every single file which would be quite annoying to users.

Any way around that?