# Accessing file on disk - Incorrect permissions

**URL:** <https://discourse.nodered.org/t/accessing-file-on-disk-incorrect-permissions/16572>\
**Category:** General\
**Created:** [10 October 2019 19:09 UTC](https://discourse.nodered.org/t/accessing-file-on-disk-incorrect-permissions/16572 "2019-10-10T19:09:04Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![pviljoen](https://avatars.discourse-cdn.com/v4/letter/p/ba9def/32.png) [@pviljoen](https://discourse.nodered.org/u/pviljoen)\
**Post date:** [10 October 2019 19:09 UTC](https://discourse.nodered.org/t/accessing-file-on-disk-incorrect-permissions/16572/1 "2019-10-10T19:09:04Z")

</div>

I need to access a file on desk to create a demo. No Luck. here is what I have done.

Uninstalled and re-installed. Solved other problems accept the file access isse.  
Rechecked the file for the correct permissions. Granted Full permissions.

-rwxrwxrwx 1 pieter pieter 48441 Oct 8 09:50 sampledata.json

Checked user has full acces to folders. all is good. see above

Yet everytime I want to access the file I get the following error

Error: EACCES: permission denied, open '/home/pieter/Documents/AWSSamples/sampledata.json'

---

<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:** [10 October 2019 19:11 UTC](https://discourse.nodered.org/t/accessing-file-on-disk-incorrect-permissions/16572/2 "2019-10-10T19:11:01Z")

</div>

What account does node-red run under? Possibly **not** `pieter`?

---

<div class="post-metadata">

**Author:** ![pviljoen](https://avatars.discourse-cdn.com/v4/letter/p/ba9def/32.png) [@pviljoen](https://discourse.nodered.org/u/pviljoen)\
**Post date:** [10 October 2019 19:12 UTC](https://discourse.nodered.org/t/accessing-file-on-disk-incorrect-permissions/16572/3 "2019-10-10T19:12:20Z")

</div>

Not sure since it does not ask me for logon access. Yet checking the users and groups, cannot find the normal node-red user or group.

---

<div class="post-metadata">

**Author:** ![afelix](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/afelix/32/9743_2.png) [@afelix](https://discourse.nodered.org/u/afelix)\
**Post date:** [10 October 2019 19:16 UTC](https://discourse.nodered.org/t/accessing-file-on-disk-incorrect-permissions/16572/4 "2019-10-10T19:16:53Z")

</div>

How did you install Node-RED/how do you start it?

If you need a quick way to know which user it runs at, try the following flow:

```auto
[{"id":"4e48d39.82fbcac","type":"inject","z":"d641cc9a.35b15","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":140,"y":500,"wires":[["b19e703e.217458"]]},{"id":"b19e703e.217458","type":"exec","z":"d641cc9a.35b15","command":"whoami","addpay":false,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"","x":300,"y":500,"wires":[["3c00b4e5.690a4c"],[],[]]},{"id":"3c00b4e5.690a4c","type":"debug","z":"d641cc9a.35b15","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":450,"y":500,"wires":[]}]

```

which runs `whoami` and tells you the user it is running at.

---

<div class="post-metadata">

**Author:** ![pviljoen](https://avatars.discourse-cdn.com/v4/letter/p/ba9def/32.png) [@pviljoen](https://discourse.nodered.org/u/pviljoen)\
**Post date:** [10 October 2019 19:17 UTC](https://discourse.nodered.org/t/accessing-file-on-disk-incorrect-permissions/16572/5 "2019-10-10T19:17:12Z")

</div>

Forgot to add. Fresh Ubuntu install on laptop

---

<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:** [10 October 2019 19:17 UTC](https://discourse.nodered.org/t/accessing-file-on-disk-incorrect-permissions/16572/6 "2019-10-10T19:17:55Z")

</div>

Probably running as a service. As I have no idea what system you fly, it's difficult to help. However I'm fairly sure it's not your account.

---

<div class="post-metadata">

**Author:** ![pviljoen](https://avatars.discourse-cdn.com/v4/letter/p/ba9def/32.png) [@pviljoen](https://discourse.nodered.org/u/pviljoen)\
**Post date:** [10 October 2019 19:20 UTC](https://discourse.nodered.org/t/accessing-file-on-disk-incorrect-permissions/16572/7 "2019-10-10T19:20:43Z")

</div>

10/10/2019, 2:18:21 PM[node: 7eb0ba89.c7fd7c](http://localhost:1880/#)

msg.payload : string[0]

""

Error 126!

---

<div class="post-metadata">

**Author:** ![pviljoen](https://avatars.discourse-cdn.com/v4/letter/p/ba9def/32.png) [@pviljoen](https://discourse.nodered.org/u/pviljoen)\
**Post date:** [10 October 2019 19:22 UTC](https://discourse.nodered.org/t/accessing-file-on-disk-incorrect-permissions/16572/8 "2019-10-10T19:22:49Z")

</div>

10/10/2019, 2:22:17 PM[node: 7eb0ba89.c7fd7c](http://localhost:1880/#)

msg.payload : string[38]

string[38]

/bin/sh: 1: whoami: Permission denied

---

<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:** [10 October 2019 19:31 UTC](https://discourse.nodered.org/t/accessing-file-on-disk-incorrect-permissions/16572/9 "2019-10-10T19:31:20Z")

</div>

How did you install node red and how are you running it?

---

<div class="post-metadata">

**Author:** ![pviljoen](https://avatars.discourse-cdn.com/v4/letter/p/ba9def/32.png) [@pviljoen](https://discourse.nodered.org/u/pviljoen)\
**Post date:** [10 October 2019 19:33 UTC](https://discourse.nodered.org/t/accessing-file-on-disk-incorrect-permissions/16572/10 "2019-10-10T19:33:19Z")

</div>

Installed it from system apps "Ubuntu Software Icon" and running directly from webpage "[http://localhost:1880/#flow/3534930b.2a47b4](http://localhost:1880/#flow/3534930b.2a47b4)"

I only logged on with the default user (Pieter)

---

<div class="post-metadata">

**Author:** ![ghayne](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ghayne/32/39_2.png) [@ghayne](https://discourse.nodered.org/u/ghayne)\
**Post date:** [10 October 2019 19:36 UTC](https://discourse.nodered.org/t/accessing-file-on-disk-incorrect-permissions/16572/11 "2019-10-10T19:36:07Z")

</div>

> [@pviljoen](#):
>
> I only logged on with the default user (Pieter)

In the original post you gave permissions to pieter and you log on with Pieter! There is a difference.

---

<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:** [10 October 2019 19:38 UTC](https://discourse.nodered.org/t/accessing-file-on-disk-incorrect-permissions/16572/12 "2019-10-10T19:38:35Z")

</div>

Does node-red run from command line or as a service?

If it's a service then I guess some service account is running node-red and it's this account that is trying to access the file - not pieter

I suggest you read up on services and accounts for Ubuntu.

Perhaps your file should be moved to inside .node-red folder?

---

<div class="post-metadata">

**Author:** ![pviljoen](https://avatars.discourse-cdn.com/v4/letter/p/ba9def/32.png) [@pviljoen](https://discourse.nodered.org/u/pviljoen)\
**Post date:** [10 October 2019 19:40 UTC](https://discourse.nodered.org/t/accessing-file-on-disk-incorrect-permissions/16572/13 "2019-10-10T19:40:36Z")

</div>

Run as a services, since it is only started from the the webpage. Or is this not correct?

---

<div class="post-metadata">

**Author:** ![ghayne](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ghayne/32/39_2.png) [@ghayne](https://discourse.nodered.org/u/ghayne)\
**Post date:** [10 October 2019 19:41 UTC](https://discourse.nodered.org/t/accessing-file-on-disk-incorrect-permissions/16572/14 "2019-10-10T19:41:54Z")

</div>

From the command prompt run top or htop and you can see which user is running node-red.

---

<div class="post-metadata">

**Author:** ![pviljoen](https://avatars.discourse-cdn.com/v4/letter/p/ba9def/32.png) [@pviljoen](https://discourse.nodered.org/u/pviljoen)\
**Post date:** [10 October 2019 19:42 UTC](https://discourse.nodered.org/t/accessing-file-on-disk-incorrect-permissions/16572/15 "2019-10-10T19:42:20Z")

</div>

the node-red folder has all Root privileges and the user must only have access to files under /Documents.

---

<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:** [10 October 2019 19:44 UTC](https://discourse.nodered.org/t/accessing-file-on-disk-incorrect-permissions/16572/16 "2019-10-10T19:44:20Z")

</div>

It's a permissions error. You need to do some research. I don't have an Ubuntu to hand so can't help further.

Read up on services and accounts under Ubuntu to figure it out.

---

<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:** [10 October 2019 19:45 UTC](https://discourse.nodered.org/t/accessing-file-on-disk-incorrect-permissions/16572/17 "2019-10-10T19:45:45Z")

</div>

Try this...

> <https://askubuntu.com/questions/734907/find-the-user-under-which-a-ubuntu-service-runs>

---

<div class="post-metadata">

**Author:** ![pviljoen](https://avatars.discourse-cdn.com/v4/letter/p/ba9def/32.png) [@pviljoen](https://discourse.nodered.org/u/pviljoen)\
**Post date:** [10 October 2019 19:57 UTC](https://discourse.nodered.org/t/accessing-file-on-disk-incorrect-permissions/16572/18 "2019-10-10T19:57:16Z")

</div>

Running Top from terminal. Do not see node-red listed. Even after restarting it and doing a cache clear on the browser.

---

<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:** [10 October 2019 19:58 UTC](https://discourse.nodered.org/t/accessing-file-on-disk-incorrect-permissions/16572/19 "2019-10-10T19:58:49Z")

</div>

You won't see node-red, you'll see `node`

Did you try `ps -ef` like the link said?

---

<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:** [10 October 2019 19:59 UTC](https://discourse.nodered.org/t/accessing-file-on-disk-incorrect-permissions/16572/20 "2019-10-10T19:59:37Z")

</div>

Running it from the web page (as you put it) is not running node red it is just opening a web page on it. I believe it will have installed using the node-red snap, and has probably been autostarted as a service. What do you see if you run  
`sudo systemctl status nodered`  
also run

```auto
node-red-stop
node-red-start

```

and copy/paste the result here.

[Next page](https://discourse.nodered.org/t/accessing-file-on-disk-incorrect-permissions/16572.md?page=2)
