Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What is the correct permission for the path /var/www/html? #1490

Closed
LeducH opened this issue May 4, 2021 · 5 comments
Closed

What is the correct permission for the path /var/www/html? #1490

LeducH opened this issue May 4, 2021 · 5 comments
Labels

Comments

@LeducH
Copy link

LeducH commented May 4, 2021

I want to run occ db:add-missing-columns inside the container.

Currently I get a permissions error.

I expect to able to run. There seems to be a permission error.

I use the latest image with the details

REPOSITORY                     TAG       IMAGE ID       CREATED       SIZE
nextcloud                      latest    d44c71c2c505   2 days ago    868MB

As you can see the user group is changed to root.

% docker-compose exec app ls -al /var/www/html
docker-compose exec app ls -al /var/www/html/config
total 224
drwxrwsr-x+ 14 www-data root      4096 Apr 28 22:13 .
drwxrwxr-x   1 www-data root      4096 May  4 05:34 ..
-rw-r--r--+  1 www-data root      4125 Apr 28 21:58 .htaccess
-rw-rw-r--+  1 www-data root         0 Apr 28 22:13 .ocdata
-rw-r--r--+  1 www-data root       101 Apr 28 21:17 .user.ini
drwxr-sr-x+ 43 www-data root      4096 Apr 28 21:17 3rdparty
-rw-r--r--+  1 www-data root     17900 Apr 28 21:17 AUTHORS
-rw-r--r--+  1 www-data root     34520 Apr 28 21:17 COPYING
drwxr-sr-x+ 47 www-data root      4096 Apr 28 21:17 apps
drwxr-sr-x+  2 www-data root      4096 Apr 28 21:17 config
-rw-r--r--+  1 www-data root      3900 Apr 28 21:17 console.php
drwxr-sr-x+ 22 www-data root      4096 Apr 28 21:17 core
-rw-r--r--+  1 www-data root      5122 Apr 28 21:17 cron.php
drwxr-sr-x+  8 www-data root      4096 Apr 28 21:58 custom_apps
drwxrwx---+ 17 www-data www-data  4096 Apr 28 22:05 data
-rw-r--r--+  1 www-data root       156 Apr 28 21:17 index.html
-rw-r--r--+  1 www-data root      2960 Apr 28 21:17 index.php
drwxr-sr-x+  6 www-data root      4096 Apr 28 21:17 lib
-rwxr-xr-x+  1 www-data root       283 Apr 28 21:17 occ
drwxr-sr-x+  2 www-data root      4096 Apr 28 21:17 ocm-provider
drwxr-sr-x+  2 www-data root      4096 Apr 28 21:17 ocs
drwxr-sr-x+  2 www-data root      4096 Apr 28 21:17 ocs-provider
-rw-r--r--+  1 www-data root      3144 Apr 28 21:17 public.php
-rw-r--r--+  1 www-data root      5341 Apr 28 21:17 remote.php
drwxr-sr-x+  4 www-data root      4096 Apr 28 21:17 resources
-rw-r--r--+  1 www-data root        26 Apr 28 21:17 robots.txt
-rw-r--r--+  1 www-data root      2446 Apr 28 21:17 status.php
drwxr-sr-x+  3 www-data root      4096 Apr 28 21:17 themes
-rw-r--r--+  1 www-data root       382 Apr 28 21:17 version.php
total 116
drwxr-sr-x+  2 www-data root  4096 Apr 28 21:17 .
drwxrwsr-x+ 14 www-data root  4096 Apr 28 22:13 ..
-rw-r--r--+  1 www-data root   495 Apr 28 21:17 .htaccess
-rw-rw-r--+  1 www-data root    60 Apr 28 21:17 apache-pretty-urls.config.php
-rw-rw-r--+  1 www-data root    70 Apr 28 21:17 apcu.config.php
-rw-rw-r--+  1 www-data root   377 Apr 28 21:17 apps.config.php
-rw-r-----+  1 www-data root  1158 Apr 28 22:55 config.php
-rw-r--r--+  1 www-data root 59161 Apr 28 21:17 config.sample.php
-rw-rw-r--+  1 www-data root   484 Apr 28 21:17 redis.config.php
-rw-rw-r--+  1 www-data root   674 Apr 28 21:17 reverse-proxy.config.php
-rw-rw-r--+  1 www-data root  1330 Apr 28 21:17 s3.config.php
-rw-rw-r--+  1 www-data root   669 Apr 28 21:17 smtp.config.php
-rw-rw-r--+  1 www-data root  1103 Apr 28 21:17 swift.config.php

Why was this done?

I assume that

docker-compose exec app chown -R www-data:www-data /var/www/html/config/ # or 
docker-compose exec app chown -R www-data:www-data /var/www/html/data/ # or
docker-compose exec app chown -R www-data:www-data /var/www/html/

should fix the issue given that the user group www-data is correct. Therefore what is the correct user group?

@kim3k
Copy link

kim3k commented Oct 14, 2022

did u find out? i just fucked up my permission and now i dont get access to the site..

"Warning: require_once(public/Constants.php): Failed to open stream: No such file or directory in /var/www/html/lib/base.php on line 74

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/lib/base.php:74) in /var/www/html/index.php on line 80
Internal Server Error The server encountered an internal error and was unable to complete your request. Please contact the server administrator if this error reappears multiple times, please include the technical details below in your report. More details can be found in the webserver log.
Fatal error: Uncaught Error: Failed opening required 'public/Constants.php' (include_path='.:/usr/local/lib/php') in /var/www/html/lib/base.php:74 Stack trace: #0 /var/www/html/index.php(34): require_once() #1 {main} thrown in /var/www/html/lib/base.php on line 74" :o

@thomas-mc-work
Copy link

thomas-mc-work commented Nov 21, 2022

This could be dependent on the docker image you're using. If it's the Debian one, then it should be www-data respectively 33 as user ID and group ID.

@kim3k Not sure whether this is the same cause. But you could try this too.

@kim3k
Copy link

kim3k commented Nov 21, 2022

I ended up restoring from a backup :) but thanks for the reply :)

@joshtrichards
Copy link
Member

Hi @LeducH - I can't reproduce this behavior today. There are some scenarios where if you use, for example, bind mounts rather than named volumes that it's easier for permissions to get weird since they're dependent on non-Docker managed folders. I'm processing old Issues in the repository. I hope you found help through another channel such as https://help.nextcloud.com.

If this Issue is no longer relevant today, can you close it out here to avoid confusion? Thanks!

@joshtrichards
Copy link
Member

Closing. Refer to my last comment for details. Feel free to follow-up if you think this is a bug in the Docker image, but it appears to be a volume mounting or underlying host filesystem matter.

@joshtrichards joshtrichards closed this as not planned Won't fix, can't repro, duplicate, stale Oct 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants