alexbelgium / hassio-addons

My homeassistant addons
MIT License
1.48k stars 213 forks source link

🐛 [Nextcloud] folder mounted in /mnt/Nextcloud does not exist, Nextcloud giving "Your data directory is readable by other users. Please change the permissions to 0770 so that the directory cannot be listed by other users." #473

Closed bobloadmire closed 2 years ago

bobloadmire commented 2 years ago

Nextcloud

Describe the bug

I have successfully mounted a network share according to the logs to /mnt/Nextcloud, however navigating to /mnt/ shows no folders. Additionally next cloud is giving "Your data directory is readable by other users.

Please change the permissions to 0770 so that the directory cannot be listed by other users." error.

attempting chmod -R 0770 /mnt/Nextcloud errors with no such file or directory.

To Reproduce

set network drive settings set local mnt settings start nextcloud error

Full addon log

cont-init: info: /etc/cont-init.d/10-adduser.sh exited 0 cont-init: info: running /etc/cont-init.d/20-config cont-init: info: /etc/cont-init.d/20-config exited 0 cont-init: info: running /etc/cont-init.d/30-keygen.sh [11:49:37] INFO: No ssl certificates set. Auto generating ones... Generating a RSA private key .............+++++ ..............+++++ writing new private key to '/ssl/nextcloud/keys/cert.key'

... adding ssl certs in files [11:49:37] INFO: ... done cont-init: info: /etc/cont-init.d/30-keygen.sh exited 0 cont-init: info: running /etc/cont-init.d/40-config.sh Creating folders Updating permissions cont-init: info: /etc/cont-init.d/40-config.sh exited 0 cont-init: info: running /etc/cont-init.d/50-install.sh cont-init: info: /etc/cont-init.d/50-install.sh exited 0 cont-init: info: running /etc/cont-init.d/60-memcache.sh [11:49:40] INFO: Setting data diretory: /mnt/Nextcloud cont-init: info: /etc/cont-init.d/60-memcache.sh exited 0 cont-init: info: running /etc/cont-init.d/90-custom-folders cont-init: info: /etc/cont-init.d/90-custom-folders exited 0 cont-init: info: running /etc/cont-init.d/92-local_mounts.sh cont-init: info: /etc/cont-init.d/92-local_mounts.sh exited 0 cont-init: info: running /etc/cont-init.d/92-smb_mounts.sh Mounting smb share(s)... Using PUID 1000 and PGID 1000 [11:49:42] INFO: ... //192.168.0.116/i/Nextcloud successfully mounted to /mnt/Nextcloud with options cont-init: info: /etc/cont-init.d/92-smb_mounts.sh exited 0 cont-init: info: running /etc/cont-init.d/99-add_packages.sh [11:49:42] INFO: Installing additional apps : ... inotify-tools fetch http://dl-cdn.alpinelinux.org/alpine/v3.14/main/aarch64/APKINDEX.tar.gz fetch http://dl-cdn.alpinelinux.org/alpine/v3.14/community/aarch64/APKINDEX.tar.gz (1/1) Installing inotify-tools (3.20.11.0-r0) Executing busybox-1.33.1-r8.trigger OK: 289 MiB in 230 packages cont-init: info: /etc/cont-init.d/99-add_packages.sh exited 0 cont-init: info: running /etc/cont-init.d/99-custom-files [custom-init] no custom files found, skipping... cont-init: info: /etc/cont-init.d/99-custom-files exited 0 cont-init: info: running /etc/cont-init.d/99-custom_scripts.sh cont-init: info: /etc/cont-init.d/99-custom_scripts.sh exited 0 cont-init: info: running /etc/cont-init.d/99-elasticsearch.sh Full_Text_Search option not set cont-init: info: /etc/cont-init.d/99-elasticsearch.sh exited 0 cont-init: info: running /etc/cont-init.d/99-mariadb_discovery.sh [11:49:51] WARNING: MariaDB addon was found! It can't be configured automatically due to the way Nextcloud works, but you can configure it manually when running the web UI for the first time using those values : Database user : service Database password : redacted Database name : nextcloud Host-name : core-mariadb:3306 cont-init: info: /etc/cont-init.d/99-mariadb_discovery.sh exited 0 cont-init: info: running /etc/cont-init.d/99-ocr.sh cont-init: info: /etc/cont-init.d/99-ocr.sh exited 0 cont-init: info: running /etc/cont-init.d/99-trusted_domains.sh [11:49:56] INFO: Currently set trusted domains : Your data directory is readable by other users. Please change the permissions to 0770 so that the directory cannot be listed by other users. An unhandled exception has been thrown: Exception: Environment not properly prepared. in /data/config/www/nextcloud/lib/private/Console/Application.php:164 Stack trace:

0 /data/config/www/nextcloud/console.php(99): OC\Console\Application->loadCommands()

1 /data/config/www/nextcloud/occ(11): require_once('/data/config/ww...')

[11:49:58] INFO: No trusted domain set yet. The first one will be set when doing initial configuration [11:49:58] INFO: Trusted domains set in the configuration. Refreshing domains. [11:49:58] INFO: ... removing previously added trusted domain (except for first one created)

2 {main}Your data directory is readable by other users.

Please change the permissions to 0770 so that the directory cannot be listed by other users. An unhandled exception has been thrown: Exception: Environment not properly prepared. in /data/config/www/nextcloud/lib/private/Console/Application.php:164 Stack trace:

0 /data/config/www/nextcloud/console.php(99): OC\Console\Application->loadCommands()

1 /data/config/www/nextcloud/occ(11): require_once('/data/config/ww...')

cont-init: info: /etc/cont-init.d/99-trusted_domains.sh exited 1 s6-rc: info: service legacy-cont-init successfully started s6-rc: info: service init-mods: starting s6-rc: info: service init-mods successfully started s6-rc: info: service init-mods-package-install: starting s6-rc: info: service init-mods-package-install successfully started s6-rc: info: service init-mods-end: starting s6-rc: info: service init-mods-end successfully started s6-rc: info: service init-services: starting s6-rc: info: service init-services successfully started s6-rc: info: service legacy-services: starting services-up: info: copying legacy longrun cron (no readiness notification) services-up: info: copying legacy longrun nginx (no readiness notification) services-up: info: copying legacy longrun php-fpm (no readiness notification) s6-rc: info: service legacy-services successfully started s6-rc: info: service 99-ci-service-check: starting

2 {main}[ls.io-init] done.

s6-rc: info: service 99-ci-service-check successfully started Your data directory is readable by other users. Please change the permissions to 0770 so that the directory cannot be listed by other users.

Full addon config

Full_Text_Search: false OCR: false OCRLANG: eng PGID: 1000 PUID: 1000 additional_apps: inotify-tools certfile: fullchain.pem data_directory: /mnt/Nextcloud elasticsearch_server: keyfile: privkey.pem trusted_domains: redacted use_own_certs: false networkdisks: //192.168.0.116/i/Nextcloud cifsusername: CoopNet Mainframe cifspassword: redacted

System

Home Assistant 2022.9.1 Supervisor 2022.08.6 Operating System 8.5 Frontend 20220907.0 - latest

rpi 4

bobloadmire commented 2 years ago

maybe related to issue #90

alexbelgium commented 2 years ago

Hi, thanks very much for the report. Indeed when doing a local mount I put permissions as 755. I'll see if changing that helps

alexbelgium commented 2 years ago

I've pushed a new version to test

bobloadmire commented 2 years ago

unfortunately, while it works, for some reason it's using the SD card on the pi still.

image

and my network share folder is empty even after uploading a few test files.

Log:

`To support LSIO projects visit: https://www.linuxserver.io/donate/

GID/UID

User uid: 1000 User gid: 1000

cont-init: info: /etc/cont-init.d/10-adduser.sh exited 0 cont-init: info: running /etc/cont-init.d/20-config cont-init: info: /etc/cont-init.d/20-config exited 0 cont-init: info: running /etc/cont-init.d/30-keygen.sh [12:45:07] INFO: No ssl certificates set. Auto generating ones... Generating a RSA private key ................................................................................+++++ ........+++++ writing new private key to '/ssl/nextcloud/keys/cert.key'

... adding ssl certs in files [12:45:07] INFO: ... done cont-init: info: /etc/cont-init.d/30-keygen.sh exited 0 cont-init: info: running /etc/cont-init.d/40-config.sh Creating folders Updating permissions cont-init: info: /etc/cont-init.d/40-config.sh exited 0 cont-init: info: running /etc/cont-init.d/50-install.sh cont-init: info: /etc/cont-init.d/50-install.sh exited 0 cont-init: info: running /etc/cont-init.d/60-memcache.sh [12:45:10] INFO: Setting data diretory: /share/nextcloud cont-init: info: /etc/cont-init.d/60-memcache.sh exited 0 cont-init: info: running /etc/cont-init.d/90-custom-folders cont-init: info: /etc/cont-init.d/90-custom-folders exited 0 cont-init: info: running /etc/cont-init.d/92-local_mounts.sh cont-init: info: /etc/cont-init.d/92-local_mounts.sh exited 0 cont-init: info: running /etc/cont-init.d/92-smb_mounts.sh Mounting smb share(s)... Using PUID 1000 and PGID 1000 [12:45:12] INFO: ... //192.168.0.116/i/Nextcloud successfully mounted to /mnt/Nextcloud with options cont-init: info: /etc/cont-init.d/92-smb_mounts.sh exited 0 cont-init: info: running /etc/cont-init.d/99-add_packages.sh [12:45:12] INFO: Installing additional apps : ... inotify-tools fetch http://dl-cdn.alpinelinux.org/alpine/v3.14/main/aarch64/APKINDEX.tar.gz fetch http://dl-cdn.alpinelinux.org/alpine/v3.14/community/aarch64/APKINDEX.tar.gz (1/1) Installing inotify-tools (3.20.11.0-r0) Executing busybox-1.33.1-r8.trigger OK: 289 MiB in 230 packages cont-init: info: /etc/cont-init.d/99-add_packages.sh exited 0 cont-init: info: running /etc/cont-init.d/99-custom-files [custom-init] no custom files found, skipping... cont-init: info: /etc/cont-init.d/99-custom-files exited 0 cont-init: info: running /etc/cont-init.d/99-custom_scripts.sh cont-init: info: /etc/cont-init.d/99-custom_scripts.sh exited 0 cont-init: info: running /etc/cont-init.d/99-elasticsearch.sh Full_Text_Search option not set cont-init: info: /etc/cont-init.d/99-elasticsearch.sh exited 0 cont-init: info: running /etc/cont-init.d/99-mariadb_discovery.sh [12:45:17] WARNING: MariaDB addon was found! It can't be configured automatically due to the way Nextcloud works, but you can configure it manually when running the web UI for the first time using those values : Database user : service Database password : thoxeithaeCai6Mohquee6oNgahc1ceoRohJohshaiw9ToobaiT7aeyohxohy5ch Database name : nextcloud Host-name : core-mariadb:3306 cont-init: info: /etc/cont-init.d/99-mariadb_discovery.sh exited 0 cont-init: info: running /etc/cont-init.d/99-ocr.sh cont-init: info: /etc/cont-init.d/99-ocr.sh exited 0 cont-init: info: running /etc/cont-init.d/99-trusted_domains.sh [12:45:22] INFO: Currently set trusted domains : 192.168.0.113:8099 [12:45:24] INFO: Trusted domains set in the configuration. Refreshing domains. [12:45:24] INFO: ... removing previously added trusted domain (except for first one created) System config value trusted_domains => 2 deleted System config value trusted_domains => 3 deleted System config value trusted_domains => 4 deleted System config value trusted_domains => 5 deleted [12:45:31] INFO: ... alignement with trusted domains list : nc.obsidianmkt.com [12:45:31] INFO: ... adding nc.obsidianmkt.com System config value trusted_domains => 6 set to string nc.obsidianmkt.com [12:45:32] INFO: Remaining configurated trusted domains : [12:45:34] INFO: 192.168.0.113:8099 nc.obsidianmkt.com cont-init: info: /etc/cont-init.d/99-trusted_domains.sh exited 0 s6-rc: info: service legacy-cont-init successfully started s6-rc: info: service init-mods: starting s6-rc: info: service init-mods successfully started s6-rc: info: service init-mods-package-install: starting s6-rc: info: service init-mods-package-install successfully started s6-rc: info: service init-mods-end: starting s6-rc: info: service init-mods-end successfully started s6-rc: info: service init-services: starting s6-rc: info: service init-services successfully started s6-rc: info: service legacy-services: starting services-up: info: copying legacy longrun cron (no readiness notification) services-up: info: copying legacy longrun nginx (no readiness notification) services-up: info: copying legacy longrun php-fpm (no readiness notification) s6-rc: info: service legacy-services successfully started s6-rc: info: service 99-ci-service-check: starting [ls.io-init] done. s6-rc: info: service 99-ci-service-check successfully started`

config:

Full_Text_Search: false OCR: false OCRLANG: eng PGID: 1000 PUID: 1000 additional_apps: inotify-tools certfile: fullchain.pem data_directory: /share/nextcloud elasticsearch_server: keyfile: privkey.pem trusted_domains: redacted use_own_certs: false networkdisks: //192.168.0.116/i/Nextcloud cifsusername: redacted cifspassword: redacted

bobloadmire commented 2 years ago

I navigated to /share/nexctcloud and the files are indeed there, but it didn't mount them to my network share, even though the log said it was mounted successfully.

alexbelgium commented 2 years ago

Strange, I'll look at it tommorow. Thanks!

alexbelgium commented 2 years ago

Actually I think I remember... The data directory is set at first run, where you can choose where it should be located, no? You could try making a backup, delete the next cloud folder and addon, then reinstall to get the initiao setup form?

And this addon option only prefills the field, but has no effect after initial setup

bobloadmire commented 2 years ago

Ok i'll give that a shot. I also noticed in the logs "[13:48:36] INFO: ... //192.168.0.116/i/nextcloud successfully mounted to /mnt/nextcloud with options "

it supposed to be /share/nextcloud not /mnt/nextcloud right?

bobloadmire commented 2 years ago

ok no dice. I completely uninstalled nextcloud and mariadb, deleted the folder in /share/, reinstalled mariadb and then nextcloud, set everything up from scratch, same thing. files are on sd card in /share/nextcloud. the /nextcloud directory on my share is empty, files are on the sd card.

bobloadmire commented 2 years ago

yeah I think that was the problem, I started over and changed the config to mnt/nextcloud from /share/nextcloud and all is well so far.

bobloadmire commented 2 years ago

noooooooo so close. so now that it's populating files on my network share correctly, i'm getting "Error Your data directory is readable by other users.

Please change the permissions to 0770 so that the directory cannot be listed by other users."

is it somehow detecting the share permissions on my smb share?

also chmod -R 0770 /mnt/nextcloud errors no such file or directory. weird.

alexbelgium commented 2 years ago

Ah, great, we're moving forward! I'll modify the documentation when I'll have more time to make more explicit that data folder is defined at first installation. For permissions, I'll push a new version now. Thanks very much for this troubleshooting!

alexbelgium commented 2 years ago

Is this better?

bobloadmire commented 2 years ago

i'm going to nuke the install and start from scratch. i'll be back.

bobloadmire commented 2 years ago

unfortunately, same error.

"Error Your data directory is readable by other users.

Please change the permissions to 0770 so that the directory cannot be listed by other users."

extremely aggravating, because it's already written files to the share

image

why is there no "I understand the risks, proceed anyway" option???

alexbelgium commented 2 years ago

Well I thought I had disabled that from the options but it doesn't work. It's strange that suddenly it starts to enforces permissions, I'll look at it. Anyway you're data is safe, just slightly less accessible for the moment

bobloadmire commented 2 years ago

well Im not worried about the data since I nuked it and started over, there's nothing there because I can't use nextcloud at all.

alexbelgium commented 2 years ago

Have you set the data folder in the addon options to the actual remote folder?

bobloadmire commented 2 years ago

not sure what you mean, I believe the answer is yes, because I need the data stored on my NAS that is backed up

config:

Full_Text_Search: false OCR: false OCRLANG: eng PGID: 1000 PUID: 1000 additional_apps: inotify-tools certfile: fullchain.pem data_directory: /mnt/nextcloud elasticsearch_server: ip:port keyfile: privkey.pem trusted_domains: redacted use_own_certs: false networkdisks: //192.168.0.116/i/nextcloud cifsusername: redacted cifspassword: redacted

alexbelgium commented 2 years ago

Could you please try data_directory: /mnt/Nextcloud? It is case sensitive and seems to be mounted with an uppercase in your log?

I'll install an instance and test

bobloadmire commented 2 years ago

I noticed that a while ago and changed the share folder to lowercase to match. the logs are probably older when the share was uppercase.

alexbelgium commented 2 years ago

Ah... Mounting the disk before creating the folder would help :) l'll update the code

bobloadmire commented 2 years ago

i'll give it a shot. should I do a clean install, or can I just upgrade?

alexbelgium commented 2 years ago

Honestly it solved an issue but still does not work... I'll continue tomorrow

bobloadmire commented 2 years ago

ugh, well thanks for trying

perebusquets commented 2 years ago

Hi, as a workaround, there's a Nextcloud option to disable this check. To do so, you have to enter the container of the addon (recommend Portainer for easy access). Then edit the file /data/config/www/nextcloud/config/config.php. Here you'll find an option (and if there isn't, just create it) called check_data_directory_permissions and you have to make sure to set it to false ('check_data_directory_permissions' => false,). Hope it helps!

alexbelgium commented 2 years ago

Thanks, I've added it as an automatic step. I had put true... :-p

bobloadmire commented 2 years ago

Ladies and Gentlemen.... WE GOT HIM. Thanks for all your help over the last couple days. everything looks to be working perfectly so far

alexbelgium commented 2 years ago

Yes, thanks very much for the feedbacks, troubleshootings, and solution ;-)