# Error while Writing File

**URL:** <https://community.n8n.io/t/error-while-writing-file/3900>\
**Category:** Questions\
**Created:** [January 20, 2021, 1:43pm UTC](https://community.n8n.io/t/error-while-writing-file/3900 "2021-01-20T13:43:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Asit\_Joshi](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/asit_joshi/32/1485_2.png) [@Asit\_Joshi](https://community.n8n.io/u/Asit_Joshi)\
**Post date:** [January 20, 2021, 1:43pm UTC](https://community.n8n.io/t/error-while-writing-file/3900/1 "2021-01-20T13:43:46Z")

</div>

Hi,

Im getting a permission error while writing a file in n8n.

 ![image](https://europe1.discourse-cdn.com/n8n/original/2X/5/591183a6b9f81119026cbf97ea1663fbcf01855b.png)

I have n8n running on docker and here is my docker-compose.yaml file.

```auto
version: "3"

services:

    n8n_5001:
      image: n8nio/n8n:latest
      ports:
        - "5001:5001"
      environment:
        - N8N_BASIC_AUTH_ACTIVE=true
        - N8N_BASIC_AUTH_USER
        - N8N_BASIC_AUTH_PASSWORD
        - N8N_HOST=${DOMAIN_NAME}
        - N8N_PORT=5001
        - N8N_PROTOCOL=https
        - NODE_ENV=production
        - N8N_PATH
        - N8N_LISTEN_ADDRESS=0.0.0.0
        - WEBHOOK_TUNNEL_URL=https://${DOMAIN_NAME}${N8N_PATH}
        - VUE_APP_URL_BASE_API=https://${DOMAIN_NAME}${N8N_PATH}
      volumes:
        - /var/run/docker.sock:/var/run/docker.sock
        - /root/n8n_5001/.n8n_5001:/root/.n8n_5001

```

I’ve also given permission to the directory

```auto
drwxrwxrwx 3 1001 1001 4096 Nov 2 08:48 n8n_5001

```

---

<div class="post-metadata">

**Author:** ![jan](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jan/32/9_2.png) [@jan](https://community.n8n.io/u/jan)\
**Post date:** [January 20, 2021, 5:37pm UTC](https://community.n8n.io/t/error-while-writing-file/3900/2 "2021-01-20T17:37:07Z")

</div>

> [@Asit\_Joshi](#):
>
> ```auto
> volumes:
> - /var/run/docker.sock:/var/run/docker.sock
> - /root/n8n_5001/.n8n_5001:/root/.n8n_5001
> 
> ```

There are two problems:

1. Unrelated to your problem but right now all the information will be lost after every restart as you mount to `/root/.n8n_5001`. n8n will not care about that folder as it looks only for `/root/.n8n`. So you would have to change the line to: `- /root/n8n_5001/.n8n_5001:/root/.n8n`
2. Your actual problem. You are writing to the folder `/data` but that data does not exist and fails for that reason. If you want to write to that folder and that folder should be accessible from the host you have to add a line like: `- /root/n8n_5001_data:/data`

---

<div class="post-metadata">

**Author:** ![Asit\_Joshi](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/asit_joshi/32/1485_2.png) [@Asit\_Joshi](https://community.n8n.io/u/Asit_Joshi)\
**Post date:** [January 20, 2021, 5:49pm UTC](https://community.n8n.io/t/error-while-writing-file/3900/3 "2021-01-20T17:49:35Z")

</div>

Thanks a lot @jan 😃

---

<div class="post-metadata">

**Author:** ![jan](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jan/32/9_2.png) [@jan](https://community.n8n.io/u/jan)\
**Post date:** [January 20, 2021, 5:55pm UTC](https://community.n8n.io/t/error-while-writing-file/3900/4 "2021-01-20T17:55:48Z")

</div>

You are welcome. Have fun!
