File permissions error with LSIO image

Support intro

Sorry to hear you’re facing problems. :slightly_frowning_face:

The community help forum (help.nextcloud.com) is for home and non-enterprise users. Support is provided by other community members on a best effort / β€œas available” basis. All of those responding are volunteering their time to help you.

If you’re using Nextcloud in a business/critical setting, paid and SLA-based support services can be accessed via portal.nextcloud.com where Nextcloud engineers can help ensure your business keeps running smoothly.

Getting help

In order to help you as efficiently (and quickly!) as possible, please fill in as much of the below requested information as you can.

Before clicking submit: Please check if your query is already addressed via the following resources:

(Utilizing these existing resources is typically faster. It also helps reduce the load on our generous volunteers while elevating the signal to noise ratio of the forums otherwise arising from the same queries being posted repeatedly).

Some or all of the below information will be if it isn’t supplied; for fastest

I’m new to nextcloud and today when I copied over files and ran a occ command it picked up all the files but when I try to upload from android I get permission error and I changed the permissions using

sudo chown -R www-data:www-data /mnt/cloud/nextcloud

I get Error

Configuration was not read or initialized correctly, not overwriting /app/www/public/config/config.php

My config file is

GNU nano 8.4 docker-compose.yml

-–

services:

nextcloud:

image: lscr.io/linuxserver/nextcloud:latest

container_name: nextcloud

environment:

  - PUID=1000

  - PGID=1000

  - TZ=Etc/UTC

volumes:

  - /mnt/cloud/nextcloud/config:/config

  - /mnt/cloud/nextcloud/data:/data

ports:

  - 447:443
 -8080:80
restart: unless-stopped

Portainer log

ctions

usermod: no changes

───────────────────────────────────────

  β–ˆβ–ˆβ•—     β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—

  β–ˆβ–ˆβ•‘     β–ˆβ–ˆβ•”β•β•β•β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β•β–ˆβ–ˆβ•—

  β–ˆβ–ˆβ•‘     β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•‘

  β–ˆβ–ˆβ•‘     β•šβ•β•β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•‘

  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•

  β•šβ•β•β•β•β•β•β•β•šβ•β•β•β•β•β•β•β•šβ•β• β•šβ•β•β•β•β•β•

Brought to you by linuxserver.io

───────────────────────────────────────

To support LSIO projects visit:

───────────────────────────────────────

GID/UID

───────────────────────────────────────

User UID: 1000

User GID: 1000

───────────────────────────────────────

Linuxserver.io version: 34.0.3-ls447

Build-date: 2026-08-25T12:06:59+00:00

───────────────────────────────────────

using keys found in /config/keys

[custom-init] No custom files found, skipping…

[ls.io-init] done.

Cannot write into β€œconfig” directory!

This can usually be fixed by giving the web server write access to the config directory.

But, if you prefer to keep config.php file read only, set the option β€œconfig_is_read_only” to true in it.

See Documentation Redirect

2026-09-01T09:50:00+00:00 3 fopen(/app/www/public/config/config.php): Failed to open stream: Permission denied at /app/www/public/lib/private/Config.php#221 | reqId=3v6Qls8vhPLib7xYFUd0 remoteAddr= user=-- app=PHP method= url=-- scriptName=/app/www/public/cron.php userAgent=-- version= occ_command=[β€œ/app/www/public/cron.php”] data={β€œapp”:β€œPHP”}

[migrations] started

[migrations] 01-nginx-site-confs-default: skipped

[migrations] 02-default-location: skipped

[migrations] done

usermod: no changes

───────────────────────────────────────

  β–ˆβ–ˆβ•—     β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—

  β–ˆβ–ˆβ•‘     β–ˆβ–ˆβ•”β•β•β•β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β•β–ˆβ–ˆβ•—

  β–ˆβ–ˆβ•‘     β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•‘

  β–ˆβ–ˆβ•‘     β•šβ•β•β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•‘

  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•

  β•šβ•β•β•β•β•β•β•β•šβ•β•β•β•β•β•β•β•šβ•β• β•šβ•β•β•β•β•β•

Brought to you by linuxserver.io

───────────────────────────────────────

To support LSIO projects visit:

───────────────────────────────────────

GID/UID

───────────────────────────────────────

User UID: 1000

User GID: 1000

───────────────────────────────────────

Linuxserver.io version: 34.0.3-ls447

Build-date: 2026-08-25T12:06:59+00:00

───────────────────────────────────────

using keys found in /config/keys

[custom-init] No custom files found, skipping…

[ls.io-init] done.

Cannot write into β€œconfig” directory!

This can usually be fixed by giving the web server write access to the config directory.

But, if you prefer to keep config.php file read only, set the option β€œconfig_is_read_only” to true in it.

See Documentation Redirect

2026-09-01T09:55:00+00:00 3 fopen(/app/www/public/config/config.php): Failed to open stream: Permission denied at /app/www/public/lib/private/Config.php#221 | reqId=rM7bVXTZyrOWgBvtcthI remoteAddr= user=-- app=PHP method= url=-- scriptName=/app/www/public/cron.php userAgent=-- version= occ_command=[β€œ/app/www/public/cron.php”] data={β€œapp”:β€œPHP”}

Cannot write into β€œconfig” directory!

This can usually be fixed by giving the web server write access to the config directory.

But, if you prefer to keep config.php file read only, set the option β€œconfig_is_read_only” to true in it.

See Documentation Redirect

2026-09-01T10:00:00+00:00 3 fopen(/app/www/public/config/config.php): Failed to open stream: Permission denied at /app/www/public/lib/private/Config.php#221 | reqId=2I8pbXnmlG2MBbPtbza7 remoteAddr= user=-- app=PHP method= url=-- scriptName=/app/www/public/cron.php userAgent=-- version= occ_command=[β€œ/app/www/public/cron.php”] data={β€œapp”:β€œPHP”}

Cannot write into β€œconfig” directory!

This can usually be fixed by giving the web server write access to the config directory.

But, if you prefer to keep config.php file read only, set the option β€œconfig_is_read_only” to true in it.

See Documentation Redirect

2026-09-01T10:05:00+00:00 3 fopen(/app/www/public/config/config.php): Failed to open stream: Permission denied at /app/www/public/lib/private/Config.php#221 | reqId=YpVrLd7xZVi95gZ0BaKL remoteAddr= user=-- app=PHP method= url=-- scriptName=/app/www/public/cron.php userAgent=-- version= occ_command=[β€œ/app/www/public/cron.php”] data={β€œapp”:β€œPHP”}

Cannot write into β€œconfig” directory!

This can usually be fixed by giving the web server write access to the config directory.

But, if you prefer to keep config.php file read only, set the option β€œconfig_is_read_only” to true in it.

See Documentation Redirect

2026-09-01T10:10:00+00:00 3 fopen(/app/www/public/config/config.php): Failed to open stream: Permission denied at /app/www/public/lib/private/Config.php#221 | reqId=BDYTigOt3OE7cy1wUdll remoteAddr= user=-- app=PHP method= url=-- scriptName=/app/www/public/cron.php userAgent=-- version= occ_command=[β€œ/app/www/public/cron.php”] data={β€œapp”:β€œPHP”}

Cannot write into β€œconfig” directory!

This can usually be fixed by giving the web server write access to the config directory.

But, if you prefer to keep config.php file read only, set the option β€œconfig_is_read_only” to true in it.

See Documentation Redirect

2026-09-01T10:15:00+00:00 3 fopen(/app/www/public/config/config.php): Failed to open stream: Permission denied at /app/www/public/lib/private/Config.php#221 | reqId=R5jZyByDzALuq66xG2q4 remoteAddr= user=-- app=PHP method= url=-- scriptName=/app/www/public/cron.php userAgent=-- version= occ_command=[β€œ/app/www/public/cron.php”] data={β€œapp”:β€œPHP”}

Hello,

jtr’s pointing you in the right direction, this is a classic PUID/PGID vs actual file ownership mismatch, made worse by the manual chown command you ran.

Here’s what happened: the LinuxServer.io Nextcloud image runs its internal web server as a user mapped to PUID=1000/PGID=1000 from your compose file, not as www-data on the host. When you ran:

sudo chown -R www-data:www-data /mnt/cloud/nextcloud

you changed ownership to the host’s www-data user (which has its own UID, usually not 1000), not to the UID/GID the container actually runs as internally. So now the container’s internal process (UID 1000) can’t write to files owned by a completely different UID on the host, hence β€œCannot write into config directory” and the permission denied on config.php.

Fix:

sudo chown -R 1000:1000 /mnt/cloud/nextcloud

Use the actual UID/GID number, not www-data, since www-data’s UID on your host almost certainly doesn’t match 1000. Then restart the container:

docker compose restart nextcloud

If you’re not sure what UID 1000 maps to on your host, run id www-data and cat /etc/passwd | grep 1000 to see, but generally with LinuxServer images it’s cleanest to just chown directly to the PUID/PGID numbers you set in the compose file rather than trying to match a host username.

For the Android upload permission error specifically, that should clear up once the config directory write issue is fixed, since it’s likely a downstream symptom of Nextcloud itself being in a broken read-only state, not a separate Android-specific permission issue.

Herrick

Devops engineer @accuweb.cloud

Thanks and I think its fixed now but the only problem I have is the duplicate photos app doesn’t seem to find any duplicates even tho their is

Glad the main thing’s fixed! For the duplicates app, probably just hasn’t scanned yet. Try running a full file scan first:

docker exec -u www-data php occ files:scan --all

Herrick

DevOps Engieer @accuweb.cloud

That command didn’t work so I used the console on portainer and ran occ files:scan --all and it picked up the files but duplicate file finder is not finding anything