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?
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).
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.
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.
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.
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.
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.
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.