Read/Write Node Issue

Describe the problem/error/question

Novice user trying to resolve a persistent issue accessing files using “Read/Write Files from Disk” Node. In testing (change my file name) I see that n8n can see the file if its name is correct, but “Access to the file is not allowed.”

What is the error message (if any)?

Problem in node ‘Read/Write Files from Disk‘

Access to the file is not allowed.

Please share your workflow

Share the output returned by the last node

No output

Information on your n8n setup

  • n8n version: Version 2.39.7
  • Database (default: SQLite): No idea
  • n8n EXECUTIONS_PROCESS setting (default: own, main): Don’t know
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
  • Operating system:Win 10

Hey @gbossley, while you wait for a response, here are some things that might help:

Suggested resources

Automatically matched to your question.

Docs:

Forum:

@Memoire, @Saravanan_Nagarajan1, @uidb4056 - you’ve helped with similar issues before, can you take a look?

Automatically suggested by n8n’s community bot. It’s a pilot - please share feedback here.

@gbossley

You need to enable this env var

N8N_RESTRICT_FILE_ACCESS_TO

.env has now - as follows (error persists though)…
N8N_SANDBOX_VERSION=latest
N8N_RESTRICT_FILE_ACCESS_TO=/home/node/.n8n/Documents
N8N_BASIC_AUTH_PASSWORD=xxxx
N8N_INSTANCE_AI_SANDBOX_ENABLED=true
N8N_INSTANCE_AI_SANDBOX_PROVIDER=n8n-sandbox
N8N_SANDBOX_SERVICE_URL=http://sandbox-api:8080
N8N_SANDBOX_SERVICE_API_KEY=xxxx
N8N_NODES_BASE_READWRITEFILE_ALLOWED_BASE_PATH=/home/node/.n8n/Documents

This is not needed. Not correct anyway
Did you restart n8n?

Hi @gbossley, /home/node/.n8n/Documents is inside n8n’s protected data directory. Adding it to N8N_RESTRICT_FILE_ACCESS_TO doesn’t override that protection.

Create C:/n8n-files on Windows and copy Testn8n.txt there. In your Compose file, merge these entries into your existing n8n service, keeping its other environment settings and volumes:

environment:
  - N8N_RESTRICT_FILE_ACCESS_TO=/files
volumes:
  - "C:/n8n-files:/files:ro"

Change the node’s File(s) Selector to /files/Testn8n.txt.

Then run docker compose up -d n8n from your Compose folder, replacing n8n if your service has another name. A plain restart won’t apply the changed environment or mount.

Keep the existing /home/node/.n8n volume unchanged. The new read-only mount is just for your test files.

Breakthrough thanks!!! I’m grateful for your help! I’ve been fighting this for days.