Access to the file is not allowed

Hi n8n team,

I’m using n8n v2.34.6 (Self Hosted) in Docker on Ubuntu 24.04. I’m trying to save a file (downloaded from Telegram API) using the “Read/Write Files from Disk” node with operation “Write File to Disk”. However, I always get the error:

“Access to the file is not allowed.”

Here is my Docker run command:

bash

docker run -d \
  --name n8n \
  --restart always \
  -p 5678:5678 \
  -e N8N_BASIC_AUTH_ACTIVE=true \
  -e N8N_BASIC_AUTH_USER=admin \
  -e N8N_BASIC_AUTH_PASSWORD=MySecurePass123a \
  -e WEBHOOK_URL=https://wvolcha-n8n.duckdns.org/ \
  -e N8N_EDITOR_BASE_URL=https://wvolcha-n8n.duckdns.org/ \
  -e N8N_ALLOW_WRITE_TO_DISK=true \
  -e N8N_ALLOW_LIST_PATH=/home/node/.n8n \
  -v n8n_data:/home/node/.n8n \
  -v /root/n8n_storage:/data \
  n8nio/n8n:2.34.6

I also ran:

bash

docker exec n8n mkdir -p /home/node/.n8n/references
docker exec n8n chown -R 1000:1000 /home/node/.n8n/references

In the workflow, the node is configured:

  • Operation: Write File to Disk

  • File Path and Name: /home/node/.n8n/references/test.ico

  • Input Binary Field: data

But I still get the error. I tried different paths: /data, /tmp/references, /home/node/.n8n. None worked. I added N8N_ALLOW_WRITE_TO_DISK=true and N8N_ALLOW_LIST_PATH. No luck.

What could be the reason? How can I allow the node to write to disk? Are there any additional settings or security restrictions in v2.34.6?

Thank you.

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

Suggested resources

Automatically matched to your question.

Docs:

Forum:

@uidb4056, @markup, @peraphat.boonndet - 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.

Hi @Wvolcha

You need to change the N8N_ALLOW_LIST_PATH to the actual directory you intend for file storage. Since you’ve already mounted a volume to /data, that’s the perfect place.

Update the environment variable in your Docker run command like this:

Change this:
-e N8N_ALLOW_LIST_PATH=/home/node/.n8n

To this:
-e N8N_ALLOW_LIST_PATH=/data

After restarting your container with this change, you will be able to write files to any path inside the /data directory (e.g., /data/references/test.ico), and it will correctly save them to your host machine’s /root/n8n_storage folder.

Hi @Wvolcha Welcome!
N8N_ALLOW_WRITE_TO_DISK and N8N_ALLOW_LIST_PATH are not n8n variables, so nothing set on them has any effect. The one the file nodes actually read is N8N_RESTRICT_FILE_ACCESS_TO, which defaults to ~/.n8n-files since 2.0:

-e N8N_RESTRICT_FILE_ACCESS_TO=/data

Separate multiple directories with ;, not a comma. /home/node/.n8n stays blocked whatever you allow-list, it’s n8n’s own state directory. The host folder needs to belong to the node user as well, so run chown -R 1000:1000 /root/n8n_storage before you recreate the container.

Thank you!

Hi @Anshul_Namdev, thank you so much! I changed my Docker command and used:

bash

-e N8N_RESTRICT_FILE_ACCESS_TO=/data

instead of the non-existent variables. I also ran chown -R 1000:1000 /root/n8n_storage and mounted the volume. The Read/Write Files from Disk node now works perfectly and saves files to /data.

Really appreciate the clear explanation — exactly what I neededThank you!