Can’t create or write into the data directory

Hello,

I know, it has to be a permission problem, but I can’t figure it out.
I want my data directory to be /opt/nextcloud/data and did chmod 777 -R /opt/nextcloud because of the error.
Same to /var/www/vhosts/mywebsite/nextcloud but still the same error.
User is ncuser group is psacln because I’m using Plesk.
Can’t Plesk be the problem?
I’m totally stuck, thanks for any help!

Best regards
Proton

That’s scary. I would start with this: https://docs.nextcloud.com/server/12/admin_manual/installation/installation_wizard.html#setting-strong-directory-permissions
And go from there. If you’re using Apache, the user and group for all data should be www-data. From there, you may need to add your other users to the www-data group so they also have access.

Thanks for your answer.
As I said, I’m using Plesk, so I think I’m using apache but I can’t promise.
Nevertheless every subdomain generated through the web-interface sets user and group to ncuser:psacln so don’t I mess with permissions if I set user and group to www-data:www-data?

Best regards

I just found it and now I’m sure: I AM using apache :slight_smile:

is plesk using SELinux? I know for CentOS 7 based installs, you also have to set some SELinux contexts to /data, /config, and /apps

Hello,

good point, but when I wanted to check if SELinux is enabled or disabled I got this:
The program ‘getenforce’ is currently not installed. You can install it by typing:
sudo apt-get install selinux-utils
So I guess it’s not in use and therefore can’t be the problem. :confused:

Best regards

If you’re using Nextcloud, you have to make it the authority over your data. So setting the apache user as the owner and group of all your data as described in the installation wizard guide. From there, you can decide how to share access to that data (read only) to other services like Plesk. If Plesk has read/write access to the data, your Nextcloud database will get out of sync.

Okay, now I changed user and group to www-data:www-data but still the same error.

But I took a look in the log file and it’s telling something about allowed path

{“reqId”:“T8VdFlqPLup6AWQ7686i”,“remoteAddr”:“189.20.219.154”,“app”:“PHP”,“message”:“mkdir(): open_basedir restriction in effect. File(/opt/nextcloud/data) is not within the allowed path(s): (/var/www/vhosts/nc/:/tmp/) at /var/www/vhosts/nc/nextcloud/lib/private/Setup.php#289”,“level”:3,“time”:“2017-03-16T19:16:17+00:00”,“method”:“POST”,“url”:"/index.php",“user”:"–",“version”:""}

Where to set this path?

It’s in your php.ini. Normally somewhere in /etc/php*/*. But with Plesk there is probably a different for each user.

Hi,

there is /etc/php5/apache2/php.ini but I have no idea if this is the right file or what option I have to edit. :confused:
I tried include_path and open_basedir but still nothing changed. I read something about /var/www/vhosts/ncuser/nextcloud/config/config.php but this file in nearly empty

<?php

$CONFIG = array (
‘instanceid’ => ‘oc0izmb1h7um’,
);

Maybe this will help?

Perfect, this link gave me the answer. :smiley:

I needed to go to the PHP Settings and set open_basedir to ‘none’.

Thanks to everyone for the help. :slight_smile:

Best regards
Proton