Read/Write Files from Disk The file "x" is not writable

Good morning, I'm a beginner with n8n, and I'm having trouble reading/writing files from disk.
I have a workflow that works fine up to the HTTP request, but when I try to write PDF files to disk, I get an error saying I can't write to disk.
I'm using:
Docker
Windows 11 - WSL
I've attached my docker-compose.yml file; it might be a bit messy. I've tried every solution I found online.
The folder where I want to save the files is c:\n8n_files\OT\01_Entrada. In n8n, it shows up with the "Mount" message.
If you can help me, I'd be very grateful.

docker-compose.yml
services:
n8n:
image: n8nio/n8n:latest
platform: linux/amd64
environment:
N8N_EDITOR_BASE_URL: http://0.tcp.sa.ngrok.io:11167
WEBHOOK_URL: http://0.tcp.sa.ngrok.io:11167
N8N_HOST: 0.tcp.sa.ngrok.io
N8N_PORT: 5678
N8N_BINARY_DATA_MODE: filesystem
N8N_RESTRICT_FILE_ACCESS_TO: /n8n_files/
N8N_BINARY_DATA_STORAGE_PATH: /home/node/files/.binary
N8N_PROTOCOL: http
GENERIC_TIMEZONE: America/Sao_Paulo
N8N_LOG_LEVEL: debug
N8N_SECURE_COOKIE: false
N8N_USER_MANAGEMENT_DISABLED: true
N8N_BASIC_AUTH_ACTIVE: false
N8N_COMMUNITY_PACKAGES_ALLOW_TOOL_USAGE: true
N8N_BLOCK_FS_WRITE_ACCESS_TO_WHITELIST: false
N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS: false
N8N_BLOCK_FS_WRITE_ACCESS: false
NODES_EXCLUDE:
N8N_RUNNERS_ENABLED: true
volumes:
- n8n_data:/home/node/.n8n
- C:/n8n_files:/home/node/files:rw
ports:
- “5678:5678”
PrintScreen:


Hi @Poxitite

update the environment variable to match your container’s internal path: N8N_RESTRICT_FILE_ACCESS_TO=/home/node/files/

because your docker-compose.yml tells n8n it is strictly only allowed to access /n8n_files/. however, you mounted your volume to /home/node/files

services:
  n8n:
    image: n8nio/n8n:latest
    platform: linux/amd64
    environment:
      # ... your other env vars ...
      N8N_RESTRICT_FILE_ACCESS_TO: /home/node/files
      N8N_BINARY_DATA_MODE: filesystem
      N8N_BINARY_DATA_STORAGE_PATH: /home/node/files/.binary
    volumes:
      - n8n_data:/home/node/.n8n
      - C:/n8n_files:/home/node/files:rw

Thank you very much for your response.

But it still doesn’t work; I’ve tried. It returns the same error.
After changing the docker-compose.yml file and using docker compose down and docker compose up -d, I still can’t write to the file.

1 Like

windows is likely locking the folder permissions when docker mounts it.

add a new line user: "root" right below your image: n8nio/n8n:latest line in the compose file to bypass the permission lock.

don’t forget to run docker compose down and docker compose up -d to apply the changes.

let me know if it still blocks you.

1 Like

Hey @Poxitite,
Welcome to the community!

this error is usually either n8n blocking the path or the container user not having write permission to the Windows-mounted folder. In your docker-compose.yml you currently have N8N_RESTRICT_FILE_ACCESS_TO: /n8n_files/ but your actual mount is C:/n8n_files:/home/node/files:rw, so n8n can end up refusing writes because the allowed path doesn’t match where you’re writing.

Set N8N_RESTRICT_FILE_ACCESS_TO=/home/node/files (and remove the /n8n_files one), then fully restart with docker compose down and docker compose up -d. After that, verify the container can actually write by executiing in and running a quick write test like touch /home/node/files/OT/01_Entrada/test.txt (also check perms with ls -ld on those folders).

if the touch fails, it’s a Windows/WSL mount permissions issue (the container runs as the node user and sometimes the mount behaves effectively read-only), in which case a quick fix is to temporarily run the container as root (user: “0:0”), chown -R node:node /home/node/files, then switch back and restart.

One small extra thing: your filenames include spaces (e.g., 5058-horas Categorias.pdf) which usually works but can still cause edge-case issues, so if everything else is fixed and it still fails, try replacing spaces with underscores in the filename expression.

If you paste the output of that touch test (and the ls -ld lines), I can tell you exactly whether it’s the n8n restriction or mount permissions causing it.

The path fix is right but WSL + Docker volume mounts to Windows paths are notoriously finicky with permissions. Try adding user: "root" to your compose file like suggested, and if that still doesn’t work try creating the folder structure inside WSL itself (like /mnt/c/n8n_files/OT/01_Entrada) and make sure the folder exists and is writable with chmod 777 on it before mounting. Windows folder permissions don’t always translate cleanly through the WSL layer.

Looking at the screenshots, the folder structure exists inside the container at /home/node/files/OT/01_Entrada/ which is good, but the write still fails even with the path fix. Since you’ve already tried the N8N_RESTRICT_FILE_ACCESS_TO change and it’s still blocking, try running docker exec -it n8nwahalocal-n8n-1 sh -c "touch /home/node/files/OT/01_Entrada/test.txt" from your terminal to see if the container can actually write there at all — if that fails too then it’s definitely a Windows/WSL mount permission issue and you’ll need the user: "root" line or to fix the folder permissions on the Windows side.

Good morning. Thank you for your responses. I couldn’t reply over the weekend because I was busy with construction work at my house. Here’s a screenshot of the test you mentioned. The test worked to generate the “test.txt” file. I had already run the test, and the “test.txt” file was from a previous test.
Regarding folder access, User, System, and admin have full control access. I’m still trying things out.
PrintScreen:



Interesting, so the touch command worked from inside the container which means the mount permissions are actually fine. The issue is probably that n8n runs as the node user by default but your exec command ran as root. Try adding user: "root" to your docker-compose like was suggested earlier, or alternatively run docker exec -it n8nwahalocal-n8n-1 sh -c "chown -R node:node /home/node/files" to give the node user ownership of that directory.

1 Like

Good morning. Thank you for your responses. I performed the test, and the result is:

@Poxitite try using sudo

Does it work if you mount another volume and restrict file access to that one?

  1. Create a folder “n8n_files” beside your docker-compose.yml
  2. mount this volume:
    - ”./n8n_files:/files”
  3. Restrict file access to the new volume:
    N8N_RESTRICT_FILE_ACCESS_TO: “/files“

Hi, @Poxitite
Please take a look at my new related tutorial: