# Write node on Synology NAS

**URL:** <https://discourse.nodered.org/t/write-node-on-synology-nas/88430>\
**Category:** General\
**Tags:** docker\
**Created:** [1 June 2024 17:52 UTC](https://discourse.nodered.org/t/write-node-on-synology-nas/88430 "2024-06-01T17:52:00Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tomtom](https://avatars.discourse-cdn.com/v4/letter/t/a9a28c/32.png) [@Tomtom](https://discourse.nodered.org/u/Tomtom)\
**Post date:** [1 June 2024 17:52 UTC](https://discourse.nodered.org/t/write-node-on-synology-nas/88430/1 "2024-06-01T17:52:00Z")

</div>

Hi everyone,  
I'm having my nodered instance running on a docker in my synology NAS.  
All my nodered files are stored within this folder \docker\nodered

With the write node, I am creating a file within this folder \docker\nodered\test.txt  
From nodered I can even read it and it works.

I can however not see that file in the NAS, is nodered storing that file somewhere else?  
Using the search function in the NAS I can find the file nowhere...

Any idea how to resolve?  
Many thanks

---

<div class="post-metadata">

**Author:** ![hardillb](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hardillb/32/12373_2.png) [@hardillb](https://discourse.nodered.org/u/hardillb)\
**Post date:** [1 June 2024 17:54 UTC](https://discourse.nodered.org/t/write-node-on-synology-nas/88430/2 "2024-06-01T17:54:34Z")

</div>

You need to work out what volumes are mounted into the container any where.

Best guess is that `/docker/nodered` is actually mounted as `/data` inside the container.

---

<div class="post-metadata">

**Author:** ![Tomtom](https://avatars.discourse-cdn.com/v4/letter/t/a9a28c/32.png) [@Tomtom](https://discourse.nodered.org/u/Tomtom)\
**Post date:** [2 June 2024 08:19 UTC](https://discourse.nodered.org/t/write-node-on-synology-nas/88430/3 "2024-06-02T08:19:57Z")

</div>

Thanks hardilib,  
This is already done, how should I access it from nodered then, via docker/nodered or via /data?

---

<div class="post-metadata">

**Author:** ![xx\_Nexus\_xx](https://avatars.discourse-cdn.com/v4/letter/x/54ee81/32.png) [@xx\_Nexus\_xx](https://discourse.nodered.org/u/xx_Nexus_xx)\
**Post date:** [2 June 2024 08:46 UTC](https://discourse.nodered.org/t/write-node-on-synology-nas/88430/4 "2024-06-02T08:46:31Z")

</div>

this is how i access a dedicated subfolder under data /data/moon .. same works with writing node

```auto
[
    {
        "id": "9de58351a99f00f9",
        "type": "file in",
        "z": "2706c23f37b98003",
        "g": "473e9bf8eb5b00bb",
        "name": "",
        "filename": "payload",
        "filenameType": "msg",
        "format": "",
        "chunk": false,
        "sendError": false,
        "encoding": "none",
        "allProps": false,
        "x": 640,
        "y": 300,
        "wires": [
            [
                "6b3e649902af74ac",
                "c4f3e1635ab024ba"
            ]
        ]
    },
    {
        "id": "6b3e649902af74ac",
        "type": "base64",
        "z": "2706c23f37b98003",
        "g": "473e9bf8eb5b00bb",
        "name": "",
        "action": "str",
        "property": "payload",
        "x": 780,
        "y": 300,
        "wires": [
            [
                "b0db3ba4922f42bf"
            ]
        ]
    },
    {
        "id": "f60a037859080a66",
        "type": "template",
        "z": "2706c23f37b98003",
        "g": "473e9bf8eb5b00bb",
        "name": "",
        "field": "payload",
        "fieldType": "msg",
        "format": "handlebars",
        "syntax": "mustache",
        "template": "/data/moon/{{astro}}.jpg",
        "output": "str",
        "x": 480,
        "y": 300,
        "wires": [
            [
                "9de58351a99f00f9"
            ]
        ]
    }
]

```

---

<div class="post-metadata">

**Author:** ![Tomtom](https://avatars.discourse-cdn.com/v4/letter/t/a9a28c/32.png) [@Tomtom](https://discourse.nodered.org/u/Tomtom)\
**Post date:** [2 June 2024 17:28 UTC](https://discourse.nodered.org/t/write-node-on-synology-nas/88430/5 "2024-06-02T17:28:37Z")

</div>

Sorry xx\_Nexus\_xx I was not able to test this, tried to copy paste but got the 3 flows which was unknown on my instance

---

<div class="post-metadata">

**Author:** ![GogoVega](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gogovega/32/71313_2.png) [@GogoVega](https://discourse.nodered.org/u/GogoVega)\
**Post date:** [2 June 2024 19:00 UTC](https://discourse.nodered.org/t/write-node-on-synology-nas/88430/6 "2024-06-02T19:00:48Z")

</div>

Just install this palette 😉

> **[node-red-node-base64](https://flows.nodered.org/node/node-red-node-base64)**
>
> A Node-RED node to pack and unpack objects to base64 format

---

<div class="post-metadata">

**Author:** ![xx\_Nexus\_xx](https://avatars.discourse-cdn.com/v4/letter/x/54ee81/32.png) [@xx\_Nexus\_xx](https://discourse.nodered.org/u/xx_Nexus_xx)\
**Post date:** [3 June 2024 00:12 UTC](https://discourse.nodered.org/t/write-node-on-synology-nas/88430/7 "2024-06-03T00:12:17Z")

</div>

hi @Tomtom, the base64 node was only required to process the image ... in your case you need

1. have the /data folder mapped to your NAS drive (i think yopu done that already)
2. use the ReadFile (as in this example) to read a file into a buffer
3. use a WriteFile in the same way to write your bufer to file ... your can write fulle files or even append to existing files (see part of code below, this example is using another maped folder /backup)

```auto
[{"id":"c794ed735e3d2474","type":"template","z":"4a94dfcf.4b415","name":"csv","field":"filename","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"/backup/{{filename}}.csv","output":"str","x":2550,"y":2040,"wires":[["3b15d24fd60b70f8"]]},{"id":"3b15d24fd60b70f8","type":"file","z":"4a94dfcf.4b415","name":"","filename":"filename","filenameType":"msg","appendNewline":false,"createDir":true,"overwriteFile":"false","encoding":"none","x":2780,"y":2040,"wires":[["ede04ab6941e7084"]]},{"id":"ede04ab6941e7084","type":"debug","z":"4a94dfcf.4b415","name":"debug 108","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":2930,"y":2040,"wires":[]}]

```

have fun

---

<div class="post-metadata">

**Author:** ![Tomtom](https://avatars.discourse-cdn.com/v4/letter/t/a9a28c/32.png) [@Tomtom](https://discourse.nodered.org/u/Tomtom)\
**Post date:** [3 June 2024 17:09 UTC](https://discourse.nodered.org/t/write-node-on-synology-nas/88430/8 "2024-06-03T17:09:05Z")

</div>

Hi xx\_Nexus\_xx,  
I run the node and it said "failed to create file: Error: EACCES: permission denied, mkdir '/backup'".  
What am I doing wrong?

---

<div class="post-metadata">

**Author:** ![xx\_Nexus\_xx](https://avatars.discourse-cdn.com/v4/letter/x/54ee81/32.png) [@xx\_Nexus\_xx](https://discourse.nodered.org/u/xx_Nexus_xx)\
**Post date:** [3 June 2024 23:34 UTC](https://discourse.nodered.org/t/write-node-on-synology-nas/88430/9 "2024-06-03T23:34:44Z")

</div>

Hi @Tomtom ,

looks like you do not have the correct user priviliges to create files and folder. I understand that you are running docker on Synology, than you will need to setup the correct file and folder permission to your /data and /backup folder.

Sorry, I have no idea on how this works on ynology, but in QNAP I had to use the filemanager to create a /backup and add PUBLIC access with permission to create/change files and subfolders .. additionally I mad sure that all my reguistered QNAP-users have full-access to this folder.

The above will open-up your Node-Red file structure to everybody and you will have to close it down (limit user-access) as soon you have it working.

**Ways to test the folder access:**

1. go into your docker console for Node-Red and manually create a file in the /data folder .. if this does not work you have to check your file/folder/user settings until it works
2. do same as above and try to create the new /backup folder manually .. if it fails .. do same as above 😉
3. use your windows filemanager and log into your folder of the Node-Red /data or /backup folder .. try to create a file or subfolder

Your issue is not with Node-Red, but with the file/folder permission on Synology with docker. You need to get help from that direction.

I'm not using the docker-environment on my QNAP NAS anymore as there were too many device/environment specific elements to consider.

I'm now running a Ubuntu LINUX-Laptop with docker and mapping all my folders to the folders on my qnap qith a few simple steps

1. Create the folder on your NAS with normal user-credentials
2. Creat a folder map on your docker environment pointing to your NAS (mine is 192.168.2.240) and im using Webmin to do the mapping  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/1/d18f4b618ef471ae3d37b1de89876d31b55a0384.png)
3. assign the folder to your NR-Docker image (I use portainer)  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/9/293f2e9bd81e8b9a779a29ec8b5fd95057128ba9.png)
4. same can be done for as many folders you like 😉

---

<div class="post-metadata">

**Author:** ![Tomtom](https://avatars.discourse-cdn.com/v4/letter/t/a9a28c/32.png) [@Tomtom](https://discourse.nodered.org/u/Tomtom)\
**Post date:** [9 June 2024 10:17 UTC](https://discourse.nodered.org/t/write-node-on-synology-nas/88430/10 "2024-06-09T10:17:52Z")

</div>

Thanks to all for your answers; I have not managed to make it working so far but will continue to digg-in within the Synology NAS !

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [7 September 2024 10:17 UTC](https://discourse.nodered.org/t/write-node-on-synology-nas/88430/11 "2024-09-07T10:17:53Z")

</div>

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