There is a cloud based on the nextcloud application, it works on the server where apache is installed, there is also a server where the mariadb database is spinning and a server where glusterfs is running. On the server where glusterfs is running, the "nextcloud" volume is created, which is the data storage for this application, and the entire database is also in this volume. On the server where the database is spinning, the "nextcloud" volume with glusterfs is mounted in the /var/lib/mysql directory. On the server where apache is installed, the "nextcloud" volume, which is located on glusterfs, is mounted in the /var/www/nextcloud-data directory. Prior to mounting, the /var/www/nextcloud-data directory is owned by www-data:www-data, but after it is mounted, the "nextcloud" volume is owned by gluster.
sudo ls -ld /var/www/nextcloud-data
drwxr-xr-x 2 www-data www-data 4096 Aug 28 12:38 /var/www/nextcloud-data
df -h
Filesystem Size Used Avail Use% Mounted on
udev 956M 0 956M 0% /dev
tmpfs 198M 812K 197M 1% /run
/dev/vda2 9.8G 4.1G 5.4G 43% /
tmpfs 986M 0 986M 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 986M 0 986M 0% /sys/fs/cgroup
10.130.0.9:/nextcloud 10G 689M 9.4G 7% /var/www/nextcloud-data
tmpfs 198M 0 198M 0% /run/user/1000
sudo ls -ld /var/www/nextcloud-data
drwxrwx--- 10 gluster ssl-cert 4096 Aug 28 10:31 /var/www/nextcloud-data
As a result, when I try to get authorization on the cloud, I get the error "Unable to create or write to the data directory /var/www/nextcloud-data"
If I do chown www-data:www-data /var/www/nextcloud-data after the "nextcloud" volume is mounted into it, then I get an error that there is no access to the database, due to the fact that there is a place on the server to spin DB where volume "nextcloud" is mounted to /var/lib/mysql directory, owner changed from mysql to www-data.
How can I solve this problem so that the /var/www/nextcloud-data directory after mounting another volume into it, it retains the owner of www-data.
I also tried to give everyone all rights to this directory and got an error that only the owner or group of the owner can write to the directory, and access to others should be denied.