Read/Write Files from Disk not work

am experiencing an issue with the “Read/Write Files from Disk” node in my self-hosted n8n instance installed via npm.
Problem Description:

The node fails with a “Permission denied” or “Access not allowed” error when trying to read or write files to a specific local directory, even though I am using absolute paths.

Hi there, welcome to the community @ahmed_faruok

This solved discussion right here might have the same problem as you, can you try this and let me know if it works?

Hi @ahmed_faruok,

If you are using version 2 of n8n, then please take note of the following breaking change where reading files from disk is disabled by default. You will need to also se this environment variable to enable disk access:

1 Like

Hey! I encountered the same issue recently. The “Read/Write Files from Disk” node is restricted to the n8n user folder by default to prevent unauthorized access to your system.

To access files on your D: drive, you need to lift these restrictions using environment variables. Here is the quickest way to solve it:

Stop your n8n instance.

Open your Command Prompt and set the following variables:

set N8N_BLOCK_FS_WRITE_ACCESS=false

set N8N_BLOCK_FS_READ_ACCESS=false

Start n8n again using n8n start.

Pro Tip: If you want this to work every time you reboot your PC, add these variables to your “Environment Variables” in Windows System Settings. This way, you won’t have to type the commands every time.

Let me know if that works for you!

Hi !
Same problem here !
Since updating to the V2 version of the Write to Disk node, I’ve been unable to get it working on my Docker-hosted n8n instance. I keep encountering an ‘Access Denied’ error every time the node tries to execute.

I have tried several configurations in my docker-compose.yaml file to fix the permissions, but without success.

Could someone with a professional eye take a look at my YAML configuration? I suspect I might be missing a volume mapping or a specific environment variable required for the new node version.

services:
db:
image: postgres:17
container_name: n8n-DB
restart: always
environment:

  • POSTGRES_DB=n8n
  • POSTGRES_USER=n8WWW
  • POSTGRES_PASSWORD=n8nWWW
    volumes:
  • /volume1/docker/n8n/db:/var/lib/postgresql/data:rw
    healthcheck:
    test: [“CMD-SHELL”, “pg_isready -h localhost -U n8nuser -d n8n”]
    interval: 5s
    timeout: 5s
    retries: 10

n8n:
image: n8nio/n8n:latest
container_name: n8n
restart: alwaysr
user: “1035:100”
privileged: true
ports:

  • 5678:5678
    volumes:

  • /volume1/docker/n8n/data:/home/node/.n8n:rw

  • /volume1/docker/n8n/files:/files:rw

  • ‘/volume1/Personnal/08 - n8n Storage:/storage:rw’
    environment:

  • N8N_HOST=n8n.WWW.synology.me

  • WEBHOOK_URL=https://n8n.WWW.synology.me

  • N8N_PROTOCOL=https

  • N8N_PORT=5678

  • N8N_USER_FOLDER=/home/node/.n8n

  • N8N_BLOCK_FS_WRITE_ACCESS=false

  • N8N_BLOCK_FS_READ_ACCESS=false

Variables DB

  • DB_TYPE=postgresdb
  • DB_POSTGRESDB_HOST=n8n-db
  • DB_POSTGRESDB_PORT=5432
  • DB_POSTGRESDB_DATABASE=n8n
  • DB_POSTGRESDB_USER=n8nWWW
  • DB_POSTGRESDB_PASSWORD=n8nWWW
  • N8N_ENCRYPTION_KEY=WWW
  • TZ=Europe/London
  • NODE_ENV=production
    depends_on:
    db:
    condition: service_healthy

Thanks in advance for your help!

hi
i am having the same issue but when write file to disk i have tried changing the envioment varibles i have tried this on docker and on npn and on ubuntu desktop it does not work if anything works please let me know

You need the environment variable N8N_RESTRICT_FILE_ACCESS_TO.
In your case, if you want to allow n8n to access /volume1/docker/n8n/files (= /files in the container), you need to add in your docker-compose.yaml:
N8N_RESTRICT_FILE_ACCESS_TO=”/files”

1 Like

I also facing this issue, then to fix this issue need add this ENV variable with specific location:
example on my case:
N8N_RESTRICT_FILE_ACCESS_TO=/home/node/.n8n/tmp_videos
Adjust the location /home/node/.n8n/tmp_videos

then on the node set the PATH
/home/node/.n8n-files/samplefile.txt

it’s working for my case