Problem with Permissions on Synology NAS

Nextcloud version (eg, 20.0.5): 25.0.0.18
Operating system and version: Synology DSM 7.1.1-42962
Apache or nginx version: Apache Http Server 2.4
PHP version: 8.0

The issue you are facing:
There is a problem with permissions.
Setting the owner as my own user account, everything works, but as soon as I upload data, the owner of the data folder becomes http:http.
Nextcloud then displays the message “This directory is unavailable, please check the logs or contact the administrator”.

Setting the owner of all folders and subfolders to http:http is not helpful either.

Is this the first time you’ve seen this error?: yes

Steps to replicate it:

  1. Install Nextcloud on Synology
  2. upload/create a file
  3. refresh, or maybe wait a bit

The output of your Nextcloud log in Admin > Logging:

Error: chmod(): Operation not permitted at /volume1/web/nextcloud/lib/private/Log/File.php#86
Error: exif_read_data(): File not supported at /volume1/web/nextcloud/lib/private/Metadata/Provider/ExifProvider.php#20
TypeError: OCA\DAV\Connector\Sabre\FilesPlugin::OCA\DAV\Connector\Sabre\{closure}(): Return value must be of type ?int, float returned

(The type error can be disregarded)

The output of your config.php file:

<?php
$CONFIG = array (
  'instanceid' => '*',
  'passwordsalt' => '*',
  'secret' => '*',
  'trusted_domains' => 
  array (
    0 => '192.168.1.115',
  ),
  'datadirectory' => '/volume1/web/nextcloud/data',
  'dbtype' => 'pgsql',
  'version' => '25.0.0.18',
  'overwrite.cli.url' => 'http://192.168.1.115/nextcloud',
  'dbname' => 'nextcloud_db',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => '*',
  'dbpassword' => '*',
  'installed' => true,
  'maintenance' => false,
  'check_data_directory_permissions' => false,
);

the check_data_directory_permissions is there, because I got the error “Your data directory is readable by other users
(see this github issue)

The output of your Apache/nginx/system log in /var/log/____:
pastebin

Output errors in nextcloud.log in /var/www/ or as admin user in top right menu, filtering for errors. Use a pastebin service if necessary:
(nothing useful, just information about the TypeError which does not affect me.

I chose to post this in “Support” because technically my installation is up and running. maybe I should also note that I tried migrating it (which I think did succeed, but I thought it had failed because of the described error), and then once or twice I deleted my installation and did it over again.

Thank you for your help :slight_smile:

Just to give you some background, in Nextcloud all files are owned by the www user on disk and should not be accessed directly. It will not work if permissions are changed.

Thats the thing, I did set all the permissions for user “http”, which seems to be the equivalent to “www-data” or “www” on normal linux systems.

Today I upated to version 25.0.1.1, and ran php80 occ maintenance:repair --include-expensive as user http. A while later multiple variations of the file: command
This did not fix anything

See the “configuration” via Synology File Station


If you saying that changing the individual read, write, execute permissions may break Nextcloud, then I misunderstood.

For some more context, I roughly followed this guide, diverging in the used database (postgres) and after the “could not load files” issue changing the permissions to see if it did anything.

Also, the “deleted files” can be viewed just fine, and the rwx permissions are exactly the same for the normal files folder, as for the files_trashbin folder.

The error doesn’t say that the ownership is wrong, but rather that “others” have read rights. Can you do a directory listing and see what the actual permissions are?

Should be 750 for folders and 640 for files if I’m not mistaken.