# Write Data to a file in a PC connected to an intranet

**URL:** https://discourse.nodered.org/t/write-data-to-a-file-in-a-pc-connected-to-an-intranet/82391
**Category:** General
**Created:** [27 October 2023 09:35 UTC](https://discourse.nodered.org/t/write-data-to-a-file-in-a-pc-connected-to-an-intranet/82391 "2023-10-27T09:35:37Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![dmb](https://avatars.discourse-cdn.com/v4/letter/d/b782af/32.png) [@dmb](https://discourse.nodered.org/u/dmb)
#### Post date: [27 October 2023 09:35 UTC](https://discourse.nodered.org/t/write-data-to-a-file-in-a-pc-connected-to-an-intranet/82391/1 "2023-10-27T09:35:37Z")

</div>

Hi,

I have node-red running on a Raspberry Pi that collects some data from sensors.  
The Raspberri Pi is connected through an ethernet cable to an intranet where there are other PC's that can access the dashboard for example.

Can I create a flow that creates/writes a text file in a PC that is connected to the intranet to store some data?

I have used the "write file" node to store data into the Raspberri Pi, but I don't know if it's possible to do the same on another device that is connected to the intranet, using the device IP address for example.

Many thanks,  
Daniel

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [27 October 2023 10:50 UTC](https://discourse.nodered.org/t/write-data-to-a-file-in-a-pc-connected-to-an-intranet/82391/2 "2023-10-27T10:50:42Z")

</div>

You could use File Sharing to allow the folder to be accessed across the network. How to do that depends on the OS you are using.

---

<div class="post-metadata">

### Author: ![dmb](https://avatars.discourse-cdn.com/v4/letter/d/b782af/32.png) [@dmb](https://discourse.nodered.org/u/dmb)
#### Post date: [27 October 2023 11:04 UTC](https://discourse.nodered.org/t/write-data-to-a-file-in-a-pc-connected-to-an-intranet/82391/3 "2023-10-27T11:04:25Z")

</div>

Thanks,

I will need to look into how to do that. The PC that contains the file uses Windows.

And if I make his file accessible, then I would still need to figure out how to write into it.

---

<div class="post-metadata">

### Author: ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)
#### Post date: [27 October 2023 11:06 UTC](https://discourse.nodered.org/t/write-data-to-a-file-in-a-pc-connected-to-an-intranet/82391/4 "2023-10-27T11:06:40Z")

</div>

You can mount a windows share in the pi filesystem and simply write files using built in file node, to the mount point.

Google is your friend: [See here](https://www.google.com/search?hl=en-GB&q=mount%20windows%20share%20on%20raspberry%20pi)

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [27 October 2023 11:51 UTC](https://discourse.nodered.org/t/write-data-to-a-file-in-a-pc-connected-to-an-intranet/82391/5 "2023-10-27T11:51:02Z")

</div>

The answer somewhat depends on your setup. Is this part of a corporate/company network for example? If so, you need to speak to the IT department before connecting things.

But in principal, you can set up something called SAMBA on the Pi. SAMBA emulates a Windows file and print sharing network on Linux OS's. So the Windows PC's would be able to connect and see the files.

You could, instead use NFS which Windows can also support (I think you have to add one of the Windows extended features though) but its performance is pretty poor.

There are lots of other options too but these are the most obvious.

---

<div class="post-metadata">

### Author: ![dmb](https://avatars.discourse-cdn.com/v4/letter/d/b782af/32.png) [@dmb](https://discourse.nodered.org/u/dmb)
#### Post date: [27 October 2023 12:14 UTC](https://discourse.nodered.org/t/write-data-to-a-file-in-a-pc-connected-to-an-intranet/82391/6 "2023-10-27T12:14:23Z")

</div>

Thanks for all the replies.

I managed to share a test file on Windows and mount it in the pi using samba 😃

---

<div class="post-metadata">

### Author: ![dmb](https://avatars.discourse-cdn.com/v4/letter/d/b782af/32.png) [@dmb](https://discourse.nodered.org/u/dmb)
#### Post date: [27 October 2023 12:30 UTC](https://discourse.nodered.org/t/write-data-to-a-file-in-a-pc-connected-to-an-intranet/82391/7 "2023-10-27T12:30:54Z")

</div>

Ok. I have one last problem.

I can read the file from node red (read file node) but not write to it using the "write file" node.

I can write from the RPi but only in sudo mode

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [27 October 2023 13:18 UTC](https://discourse.nodered.org/t/write-data-to-a-file-in-a-pc-connected-to-an-intranet/82391/8 "2023-10-27T13:18:08Z")

</div>

Your folder/file permissions are wrong. If you are running Node-RED under a specific user/group - which is advised for production use - then you need to make sure that user/group has access to the target folder. The simple way being to add the node-red user to the group permissions for the appropriate folder.

---

<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: [26 December 2023 13:18 UTC](https://discourse.nodered.org/t/write-data-to-a-file-in-a-pc-connected-to-an-intranet/82391/9 "2023-12-26T13:18:28Z")

</div>

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