# Permission problems

**URL:** <https://discourse.nodered.org/t/permission-problems/49717>\
**Category:** General\
**Created:** [14 August 2021 14:12 UTC](https://discourse.nodered.org/t/permission-problems/49717 "2021-08-14T14:12:46Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Quevedo](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/quevedo/32/46503_2.png) [@Quevedo](https://discourse.nodered.org/u/Quevedo)\
**Post date:** [14 August 2021 14:12 UTC](https://discourse.nodered.org/t/permission-problems/49717/1 "2021-08-14T14:12:46Z")

</div>

I have installed node-red at a Ubuntu machine, logged as an user with sudo priviledges, and I have run the pi script, not using "sudo". This machine will be remotely accessed by students, which do not have sudo priviledges. When I run "node-red" in my sudo account, it works normally, but when I try to run it as a non-sudo user, I get the following message:

cannot open path of the current working directory: Permission denied

I am using node-red version 2.0.5 with Node.js 12.22.5.

How do I correct this so my students can use node-red when logged into their accounts?

Thanks in advance

---

<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:** [14 August 2021 14:27 UTC](https://discourse.nodered.org/t/permission-problems/49717/2 "2021-08-14T14:27:16Z")

</div>

Do you want everyone using the same instance of the node-red server or do you want them to have an instance each (with their own flow files and so on).

---

<div class="post-metadata">

**Author:** ![Quevedo](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/quevedo/32/46503_2.png) [@Quevedo](https://discourse.nodered.org/u/Quevedo)\
**Post date:** [14 August 2021 15:12 UTC](https://discourse.nodered.org/t/permission-problems/49717/3 "2021-08-14T15:12:52Z")

</div>

Every student may need to access different MQTT topics, so it is better if every student has his or her own instance.

If that is unfeasible, they could run same instance, but I would have to add a text input for the topics so the student can type his or her topic for the dashboard controls.

---

<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:** [14 August 2021 15:19 UTC](https://discourse.nodered.org/t/permission-problems/49717/4 "2021-08-14T15:19:58Z")

</div>

> [@Quevedo](#):
>
> every student has his or her own instance.

That is no problem. If you run  
`node-red -h`  
it will show you the options on the node-red command. In particular if a user runs  
`node-red -u ~ -p 1881`  
that will tell it to start node red in the users home folder (`~`) with the server listening on port 1881. The first time that is run it will create a folder `.node-red` in the users home folder and start with an empty flows file. Make sure each user uses a different port. After running it the first time you could edit the settings.js file it makes in that folder and force the port to 1881 (or whatever) so that the `-p` parameter would no longer be necessary.

---

<div class="post-metadata">

**Author:** ![Quevedo](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/quevedo/32/46503_2.png) [@Quevedo](https://discourse.nodered.org/u/Quevedo)\
**Post date:** [14 August 2021 15:35 UTC](https://discourse.nodered.org/t/permission-problems/49717/5 "2021-08-14T15:35:56Z")

</div>

Thanks for the reply. Actually I expect only one student to be logged at any given time, so I suppose that the port parameter is not necessary. Anyway I tried to run the command with the "-u ~" option, but the same error shows up. I created the ".node-red" directory manually, and same thing happens. Maybe something in configuration needs to be changed so node-red will use the user folder instead of a fixed, unaccessible one.

---

<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:** [14 August 2021 16:03 UTC](https://discourse.nodered.org/t/permission-problems/49717/6 "2021-08-14T16:03:05Z")

</div>

> [@Quevedo](#):
>
> cannot open path of the current working directory: Permission denied

Well it works for me. Exactly how did you install node red?

Edit: Also what happens if you explicitly put in the path of the current logged in user, so something like  
`node-red -u /home/theusername`  
and what about  
`touch /home/theusername/tempfile`  
and  
`touch ~/tempfile`

Further edit. If you run the `node-red -u ~` command as a user with sudo privileges does it work? Check the startup message to make sure it has picked the files up from the right folder.

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [15 August 2021 07:17 UTC](https://discourse.nodered.org/t/permission-problems/49717/7 "2021-08-15T07:17:30Z")

</div>

When you say you created the .node-red directory manually, which user did you do that as ? It must be as the user that will be running

---

<div class="post-metadata">

**Author:** ![Quevedo](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/quevedo/32/46503_2.png) [@Quevedo](https://discourse.nodered.org/u/Quevedo)\
**Post date:** [16 August 2021 11:36 UTC](https://discourse.nodered.org/t/permission-problems/49717/8 "2021-08-16T11:36:42Z")

</div>

node-red install was made by the Pi script, choosing "no" for Pi-specific nodes.

if I try "node-red -u /home/theusername", same error happens

"touch /home/theusername/tempfile" gives me "file or directory does not exist". However "touch ~/tempfile" does not give me any message.

When I run node-red as an user with sudo priviledges, I do not even need the "-u" option. It runs seamelessly. Startup messages concerning files say:

Settings file : /home/lquevedo/.node-red/settings.js  
User directory : /home/lquevedo/.node-red  
Flows file : /home/lquevedo/.node-red/flows.json

If I run as a non-sudo user, I do not get any message besides the error.

---

<div class="post-metadata">

**Author:** ![Quevedo](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/quevedo/32/46503_2.png) [@Quevedo](https://discourse.nodered.org/u/Quevedo)\
**Post date:** [16 August 2021 11:37 UTC](https://discourse.nodered.org/t/permission-problems/49717/9 "2021-08-16T11:37:29Z")

</div>

I created the directory manually as the non-admin user, which is the one that cannot run.

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [16 August 2021 14:18 UTC](https://discourse.nodered.org/t/permission-problems/49717/10 "2021-08-16T14:18:32Z")

</div>

> [@Quevedo](#):
>
> node-red -u /home/theusername

did you actually use `theusername`? that should be the nme of the user, like  
`node-red -u /home/pi`

---

<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:** [16 August 2021 14:40 UTC](https://discourse.nodered.org/t/permission-problems/49717/11 "2021-08-16T14:40:06Z")

</div>

> [@Quevedo](#):
>
> touch /home/theusername/tempfile

I meant you to put the actual user name in.

---

<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:** [16 August 2021 15:42 UTC](https://discourse.nodered.org/t/permission-problems/49717/12 "2021-08-16T15:42:15Z")

</div>

@dceejay do you know if anyone has tried running node red in this way as a non sudo user? I can't test it as I am away from home.

---

<div class="post-metadata">

**Author:** ![Quevedo](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/quevedo/32/46503_2.png) [@Quevedo](https://discourse.nodered.org/u/Quevedo)\
**Post date:** [16 August 2021 17:41 UTC](https://discourse.nodered.org/t/permission-problems/49717/13 "2021-08-16T17:41:49Z")

</div>

Yes I used the actual username, instead of "theusername".

---

<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:** [16 August 2021 19:34 UTC](https://discourse.nodered.org/t/permission-problems/49717/14 "2021-08-16T19:34:14Z")

</div>

> [@Quevedo](#):
>
> "touch /home/theusername/tempfile" gives me "file or directory does not exist". However "touch ~/tempfile" does not give me any message

That's ridiculous, they are the same directory (assuming you are in the users home directory when you run it, which I assume you were).

---

<div class="post-metadata">

**Author:** ![Quevedo](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/quevedo/32/46503_2.png) [@Quevedo](https://discourse.nodered.org/u/Quevedo)\
**Post date:** [16 August 2021 22:31 UTC](https://discourse.nodered.org/t/permission-problems/49717/15 "2021-08-16T22:31:06Z")

</div>

I thought the same, however that's what I got. I ran at the non-sudo user which is supposed to get access.  
Maybe one better option would be to use one of the cloud implementations of node-red, but I would relly like it to work locally.

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [16 August 2021 22:50 UTC](https://discourse.nodered.org/t/permission-problems/49717/16 "2021-08-16T22:50:40Z")

</div>

Sounds like the user which node-red runs as does not have a /home/username directory, in which case ~/tempfile resolves to /tempfile?

---

<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:** [17 August 2021 06:23 UTC](https://discourse.nodered.org/t/permission-problems/49717/17 "2021-08-17T06:23:46Z")

</div>

> [@Quevedo](#):
>
> I thought the same,

What does `pwd` show when logged in as that user? If it does not show `/home/username` then that is the problem.

Edit: Also what does this show

```auto
cd ~
pwd 

```

---

<div class="post-metadata">

**Author:** ![Quevedo](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/quevedo/32/46503_2.png) [@Quevedo](https://discourse.nodered.org/u/Quevedo)\
**Post date:** [17 August 2021 15:16 UTC](https://discourse.nodered.org/t/permission-problems/49717/18 "2021-08-17T15:16:08Z")

</div>

"pwd" gives me:  
`/net/nfs1.<facultydomain>/export/vol1/home/<department>/<username>`

where `<facultydomain>` is the address domain of the faculty I work at inside the university; `<department>` is the department I work at, and `<username>` is the non-sudo username

after using `cd ~`, `pwd` returns the same.

The machine has virtual directories so I can have access to my files regardless the machine I log in. Maybe that is the problem.

**Admin Edit:** Added backticks round the lines with special characters to prevent the forum from interpreting them as markdown.

---

<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:** [20 August 2021 15:30 UTC](https://discourse.nodered.org/t/permission-problems/49717/19 "2021-08-20T15:30:02Z")

</div>

So exactly what command are you running to start node-red for that user?

---

<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:** [19 October 2021 15:30 UTC](https://discourse.nodered.org/t/permission-problems/49717/20 "2021-10-19T15:30:11Z")

</div>

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