Breaking permissions settings on docker install after chowning www-data

Nextcloud version (eg, 18.0.3):
Operating system and version (eg, Ubuntu 18.04):
nginx version (eg, Apache 1.1.17):

The issue you are facing:
I can connect to nextcloud server only by setting permission to root folder to 777

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

Steps to replicate it:

  1. set permissions into container
    docker-compose exec app chown -R www-data:www-data /var/www/html/
  2. give permissions to folder
    sudo chmod 777 -R /opt/cloud/
    and it works, owner and group is 82 and not www-data

sudo ls -la /opt/cloud
total 164
drwxrwxrwx 14 82 82 4096 Feb 16 16:16 .
drwxr-xr-x 5 root root 4096 Feb 2 13:13 …
drwxrwxrwx 33 82 82 4096 Feb 16 16:16 3rdparty
drwxrwxrwx 43 82 82 4096 Feb 2 13:19 apps
-rwxrwxrwx 1 82 82 15752 Feb 16 16:16 AUTHORS
drwxrwxrwx 2 82 82 4096 Feb 16 16:16 config
-rwxrwxrwx 1 82 82 3910 Feb 16 16:16 console.php
-rwxrwxrwx 1 82 82 34520 Feb 16 16:16 COPYING
drwxrwxrwx 23 82 82 4096 Feb 16 16:16 core
-rwxrwxrwx 1 82 82 5048 Feb 16 16:16 cron.php
drwxrwxrwx 14 82 82 4096 Feb 22 14:53 custom_apps
drwxrwxrwx 19 82 82 4096 Feb 25 10:57 data
-rwxrwxrwx 1 82 82 2627 Feb 16 16:16 .htaccess
-rwxrwxrwx 1 82 82 156 Feb 16 16:16 index.html
-rwxrwxrwx 1 82 82 2976 Feb 16 16:16 index.php
drwxrwxrwx 6 82 82 4096 Feb 16 16:16 lib
-rwxrwxrwx 1 82 82 283 Feb 16 16:16 occ
drwxrwxrwx 2 82 82 4096 Feb 16 16:16 ocm-provider
drwxrwxrwx 2 82 82 4096 Feb 16 16:16 ocs
drwxrwxrwx 2 82 82 4096 Feb 16 16:16 ocs-provider
-rwxrwxrwx 1 82 82 3056 Feb 16 16:16 public.php
-rwxrwxrwx 1 82 82 5235 Feb 16 16:16 remote.php
drwxrwxrwx 4 82 82 4096 Feb 16 16:16 resources
-rwxrwxrwx 1 82 82 26 Feb 16 16:16 robots.txt
-rwxrwxrwx 1 82 82 2381 Feb 16 16:16 status.php
drwxrwxrwx 3 82 82 4096 Feb 2 13:19 themes
-rwxrwxrwx 1 82 82 101 Feb 16 16:16 .user.ini
-rwxrwxrwx 1 82 82 362 Feb 16 16:16 version.php

  1. if I change ownership to www-data,it breaks:
    sudo chown -R www-data:www-data /opt/cloud/

The output of your Nextcloud log in case of error:

app_1  | 172.21.0.4 - fra 27/Feb/2020:21:20:46 +0000 "GET /status.php" 503
app_1  | NOTICE: PHP message: PHP Warning:  fileperms(): stat failed for /var/www/html/data/nextcloud.log in /var/www/html/lib/private/Log/File.php on line 83
app_1  | NOTICE: PHP message: {"reqId":"3Itc6fD56ruaDQbDmXxO","level":3,"time":"2020-02-27T21:20:46+00:00","remoteAddr":"192.168.1.10","user":"--","app":"PHP","method":"GET","url":"/status.php","message":"fileperms(): stat failed for /var/www/html/data/nextcloud.log at /var/www/html/lib/private/Log/File.php#83","userAgent":"Mozilla/5.0 (Linux) mirall/2.6.3git (Nextcloud)","version":"18.0.1.3"}

i guess the uid of www-data on your host and in your container are different.

just run id www-data on your host and in your conatiner.

that’s why you shouldn’t use host directories like /opt/cloud for container volumes.

you are right, now they are the same, but the problem is still there.

this is the output of: getent group www-data

‘’’
www-data:x:82:nextcloud
‘’’

Is there another user requiring access to the root folder?

setting permission to 755 as suggested in some forums (using nginx it should not be a problem), it works