Nextcloud Data folder permission changed, clients having sync issues

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:

example

Or for longer, use three backticks above and below the code snippet:

longer
example
here

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version (eg, 20.0.5): 23.0.0
Operating system and version (eg, Ubuntu 20.04): Ubuntu 20.04
Apache or nginx version (eg, Apache 2.4.25): Apache 2.4.41
PHP version (eg, 7.4): 8.0.15

Im using Plesk Obsidian 18.0.41 as Webhost.

The issue you are facing:

All my Clients have synchronization Problems. They get errors like “Error 403 forbidden”.

I think since changing the ownership of the data folder this issue appeared. But i do not know what to do anymore.

Is this the first time you’ve seen this error? (Y/N): Yes

Steps to replicate it:

  1. Install apcu and redis modules/dependencies
  2. Chance config.php to only use APCu memchace and PHP config to enable apc
  3. Disable redis service
  4. System does not use APCu memchace, when i was checking logs
  5. Give User “psacln” permission to use /data folder ( found in a help forum)

205 chown -R vhostuser:psacln /nc

/nc is my data folder (how do i revert this command?)

The output of your Nextcloud log in Admin > Logging:

Since changeing the ownership, the Logging Data on the admin webpage does not Update, so i have to put in the php logs manually and correct any identifiying information in here:

**This error keeps repeating for each of my clients:**

  [17-Mar-2022 00:00:06] WARNING: [pool vhost.de] child 560305 said into stderr: "ERROR: Unable to set php_value 'clear_env'"
  
  [17-Mar-2022 00:00:06] WARNING: [pool vhost.de] child 560305 said into stderr: "ERROR: Unable to set php_value 'apc.enable'"
  
  Failed to open stream: Permission denied at /var/www/vhosts/vhost.de/httpdocs/lib/private/Files/Storage/Local.php#282","userAgent":"Mozilla/5.0 (Windows) mirall/3.3.5stable-Win64 (build 20210930) (Nextcloud, windows-10.0.19043 ClientArchitecture: x86_64 OsArchitecture: x86_64)","version":"23.0.0.10","exception":{"Exception":"Err"} 

**This error shows that php cant write into the nc log file...**

  [17-Mar-2022 09:12:01] WARNING: [pool asscloud.de] child 560277 said into stderr: "PHP message: {"reqId":"sq0UoAqMHSnhXYgdBH3M","level":3,"time":"2022-03-17T09:12:01+00:00","remoteAddr":"91.63.76.100","user":"USER_NAME","app":"PHP","method":"POST","url":"/remote.php/dav/bulk","message":"fopen(/nc/nextcloud.log): Failed to open stream: Permission denied at /var/www/vhosts/asscloud.de/httpdocs/lib/private/Log/File.php#84","userAgent":"Mozilla/5.0 (Windows) mirall/3.4.2stable-Win64 (build 20220127) (Nextcloud, windows-10.0.19042 ClientArchitecture: x86_64 OsArchitecture: x86_64)","version":"23.0.0.10"}"


The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

<?php
$CONFIG = array (
  'instanceid' => '***********',
  'passwordsalt' => '************',
  'secret' => '**************',
  'trusted_domains' => 
  array (
    0 => 'redacted',
  ),
  'activity_expire_days' => 365,
  'datadirectory' => '/nc',
  'dbtype' => 'mysql',
  'version' => '23.0.0.10',
  'overwrite.cli.url' => 'https://redacted',
  'dbname' => 'redacted',
  'dbhost' => 'localhost:3306',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'redacted_db',
  'dbpassword' => '********',
  'installed' => true,
  'filesystem_check_changes' => 0,
  'mail_smtpmode' => 'smtp',
  'mail_smtpsecure' => 'tls',
  'mail_sendmailmode' => 'smtp',
  'mail_from_address' => 'nextcloud',
  'mail_domain' => '**********',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_smtphost' => '********',
  'mail_smtpport' => '587',
  'mail_smtpauth' => 1,
  'mail_smtpname' => '************',
  'mail_smtppassword' => '*************',
  'output_buffering' => 'OFF',
  'maintenance' => false,
  'default_phone_region' => 'DE',
  'default_language' => 'de',
  'force_language' => 'de',
  'default_locale' => 'de_DE',
  'force_locale' => 'de_DE',
  'allow_user_to_change_display_name' => false,
  'filelocking.enabled' => true,
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'redis' => 
  array (
    'host' => 0,
    'port' => 0,
  ),
  'theme' => '',
  'loglevel' => 2,
  'app_install_overwrite' => 
  array (
    0 => 'passwords',
    1 => 'files_trackdownloads',
    2 => 'twofactor_admin',
  ),
);

When listing the directories the owner of the files in the data directory is “systemd-coredump” and the group is “www-data”. Since the problem persists, i have been changing the directory permissions manually to chmod 775 “directoryname”. This was a small workaround for me, because the nextcloud instance is in a productive enviornment.

Do you guys have any ideas?

and have you try to change de owner of the folders from “systemd-coredump” to “www-data”??
chown -R www-data /var/www/nextcloud/data

insted of chmod 775?

My nextcloud install folder, all of it, is owned by www-data

Im not sure why the owner is systemd-coredump in the first place. I didnt set up the server.

it looks like this:

drwxrwx— 85 systemd-coredump www-data 4096 Mär 2 11:00 nc

this are my folders user:group and permissions

drwxr-xr-x 9 www-data www-data 4,0K

I might try this in the evening, when everyone is not actively using the nextcloud.

Okay so, I changed the permissions of the folder back to the www-data User with chown -R www-data:www-data /path/to/data/. This was the solution to the synchronisation problem with the clients.

Then I have installed the redis server again. Then put the path to the redis Server in to the config file for both memcache local and distributed. Right there I had an issue that the config file syntax was wrong. After fixing the Syntax, by executing the config with php config.php and looking for errors, the memcache is now working properly.

Thank you for the reply.