Centos 7 New Installation, folder data ouside web root

I found this error : Can’t create or write into the data directory /home/admin/nextcloud/data.
I am using Centos 7, LAMPP, and all running using root.

I want to create folder data ouside the root, because I have a lot of space disk in home.
Pls, help me. Thank you

The nextcloud user must access the directory:
chown www-data:www-data /home/admin/nextcloud/data
(set correct nextcloud-userand nextcloud-group)
Look e.g. in /var/www/html/nextcloud for the user-group-combination.

Hope you installed all packages with your package manager (yum?) and not from a another source like windows-style (xampp).

Hope not all is running as root.

@Oliver_Zakaria se linux on?

-> https://docs.nextcloud.com/server/19/admin_manual/installation/selinux_configuration.html

don’t forget to change to path to the datafolder.

Hi All,

Thank you for your reply.

I followed all your suggestions, but there was still an error.

First, I uninstalled the LAMPP. Then I installed Apache and Mariadb via Yum. then I put the nextcloud source in /var/www/html/nextcloud/

Second: I do not have the user “www-data”
[root @ localchange nextcloud] # sudo chown -R www-data: www-data config data apps
chown: invalid user: ‘www-data: www-data’

Nextcloud running as apache
[root @ localchange nextcloud] # pwd
[root @ localchange nextcloud] # ls -ltr
a total of 112
-rwxr-xr-x. 1 apache apache 34520 Jun 9 14:34 COPYING
-rwxr-xr-x. 1 apache apache 15752 Jun 9 14:34 AUTHORS
drwxr-xr-x. 3 apache apache 35 Jun 9 14:34 themes
-rwxr-xr-x. 1 apache apache 2381 Jun 9 14:34 status.php

Third: se linux is disabled
[root@localchange nextcloud]# sestatus
SELinux status: disabled

Httpd service running as apache user:

[root@localchange nextcloud]# ps -ef | grep httpd
root 1097 1 0 16:44 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
apache 1205 1097 0 16:44 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
apache 1206 1097 0 16:44 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
apache 1207 1097 0 16:44 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
apache 1208 1097 0 16:44 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
apache 1209 1097 0 16:44 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
apache 1921 1097 0 16:49 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
root 1964 1589 0 17:02 pts/0 00:00:00 grep --color=auto httpd

The error is still same " Can’t create or write into the data directory /home/admin/nextcloud/data "

There is apache user instead of www-data in Centos.

You must use the user “apache” (CentOS) and not “www-data” (Debian, Ubuntu).

chown apache:apache /home/admin/nextcloud/data

Hi devnull,

Still cannot create the data.

here the capture :
[root@localchange ~]# chown apache:apache /home/admin/nextcloud/data
[root@localchange ~]# cd /home/admin/nextcloud/
[root@localchange nextcloud]# pwd
[root@localchange nextcloud]# ls -ltr
total 0
drwxr-xr-x 2 apache apache 6 Jul 10 17:04 data

Pls help


anyone can help me ?
or can you share your configuration with data in outside of root system ?

Perhaps the user must also access the upper path:

chown apache:apache /home/admin/nextcloud

No first test it again …

Also you can set the rights to 777

chmod 777 /home/admin/nextcloud/data

and if it not works
chmod 777 /home/admin/nextcloud

is /home or /home/admin also 0700?