Cannot delete file from external local drive. Permissions error

Nextcloud version: Nextcloud AIO V7.0.0 (Nextcloud 27.0.2)
Operating system and version: Ubuntu 22.04.2
Docker version: 24.0.5

The issue you are facing:

I cannot delete files from my external local storage.
When I try I get the following error in the log

[PHP] Error: unlink(/mnt/storage/pool/Photos/2023/08/PXL_20230827_224307658.jpg): Permission denied at /var/www/html/lib/private/Files/Storage/Local.php#322

DELETE /remote.php/dav/files/v/POOL/Photos/2023/08/PXL_20230827_224307658.jpg
from by v at 2023-08-27T23:21:55+00:00

Steps to replicate it:

  1. Navigate to the file through nextcloud web interface
  2. Select delete

Things I have tried:

  1. Change permissions for the files on the external drive to 777 or 775
  2. Login to the nextcloud container (docker exec -it nextcloud-aio-nextcloud bash) and change the permissions to the file to 777 (or 775) from within the container also
  3. Run file rescan (files:scan --path=“/v/files/POOL/Photos/2023/08”)

You say external, but you just mean it’s a physically an external drive, correct? You’re not talking about Local via Nextcloud’s External Storage mode, correct?

Can you post your Docker Compose?

This is using the external storage module with local storage. Here is the docker compose:

version: "3.8"

    name: nextcloud_aio_mastercontainer

    image: nextcloud/all-in-one:latest
    restart: unless-stopped
    container_name: nextcloud-aio-mastercontainer
      - nextcloud_aio_mastercontainer:/mnt/docker-aio-config
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - 8080:8080
      - APACHE_PORT=11000
      - NEXTCLOUD_DATADIR=/mnt/ncdata
      - NEXTCLOUD_DATADIR=/mnt/scratch/ncdata
      - NEXTCLOUD_MOUNT=/mnt/storage/pool/
      - NEXTCLOUD_ADDITIONAL_APKS=libva-utils libva-vdpau-driver libva-intel-driver intel-media-driver mesa-va-gallium # List of packages from

This is using nextclouds external storage module with local storage.