Write File Node Fails with 'not writable' Error Despite Correct Volume Permissions

Describe the problem/error/question

The n8n ‘Write File’ node fails with a ‘not writable’ error when writing to /home/node/.n8n/

What is the error message (if any)?

Problem in node ‘Read/Write Files from Disk‘

The file “/home/node/.n8n/success.json” is not writable.

Please share your workflow

Share the output returned by the last node

The file “/home/node/.n8n/success.json” is not writable.

Information on your n8n setup

  • n8n version: 1.110.1
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
  • Operating system: Pop! OS

Hey!

Unless you run the container as the root user, you won’t have access to write in /home/node/.n8n. It’s not really recommended, as if an attacker takes control they will have sudo access. Here’s how:

docker volume create n8n_data

docker run -u 0 -it --rm \
 --name n8n \
 -p 5678:5678 \
 -e GENERIC_TIMEZONE="<YOUR_TIMEZONE>" \
 -e TZ="<YOUR_TIMEZONE>" \
 -e N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=true \
 -e N8N_RUNNERS_ENABLED=true \
 -v n8n_data:/root/.n8n \
 docker.n8n.io/n8nio/n8n

*Notice the -u 0 (root user) and -v n8n_data:/root/.n8n (moving .n8n under root, so the root user has access)

Recommended way would be to create a docker compose file. Inside create a second volume to which you will have write access:

volumes:
      - /n8n-data:/home/node/.n8n # you can't write here
      - ./n8n-output:/data  # you can write here

Let me know if this help and feel free to mark as solution if it did :slight_smile:

3 Likes

Thanks, I included the second line in volumes. It worked perfectly. And I got the written json file in the n8n-output folder. :+1::smile:

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.