Node-red version 4.09 no file access to my revolution pi directories

Hi,
I installed an existing and working node-red flow on a new revolution pi with node-red 4.09.
The node-red creates using a pdfmake node a file on the pi. Now I allways get errors because node-red has no access to my directories. I proofed everything with the bash commands and in debian everything is ok. I can read and write all directories with the pi user.
Node-red runs also under pi user but says "no permission".
What can I do?
It seems node-red overrides the debian pemissions or changes my path???

Thanks in advance for your help

Tim

Are you using Docker?

Hey,

This might be a problem with the working directory that node-red is using. Even if it runs as the pi user, when it’s started by systemd, it can run from a different folder like /var/lib/node-red instead of /home/pi.

Try checking what folder node-red is actually working in, for example, by using a function or exec node to run pwd.

Also, try using a full path when saving the file, like:
/home/pi/Documents/output.pdf
instead of just output.pdf because node-red might be trying to save it in a place where it doesn’t have permission.

Did you install via Dave's Pi/Debian installer script? If so, you will be running Node-RED using systemd. What permissions and path Node-RED will get come from the systemd startup script.

Typically, I believe the script creates a separate user for Node-RED? Can't remember as I don't use it myself. But the path environment variable will not be the same as when you log into the Pi user since interactive logins get their path from shell/bash startup scripts.

Path should not impact access to folders however.

Depending on what you want to do with the PDF once you've created it, you could try using the /tmp folder which should be writable by all users (obviously check that it exists first).

Hi everybody,

thank you for your answers.

I made an exec node and put 'pwd' in and now i know the working directory is '/var/lib/revpi-nodered'. Thanks to lukjasin! This directory is open to read and write.

But when i try to do this in '/home/pi' I have no permission in node-red. In bash on debian I have permission.

When I put a sudo in front e.g. 'sudo mkdir /home/test' I get a failure: the switch new privileges is set to on you can not act as root
it seems node-red is runnimg in a container

now where can I change this switch and how can I do this? It is no docker container.

Are you stating this as a fact or is it your guess at the cause of the problem (which might be correct) ?

Sorry but are you affirming that you are not running docker?
What sort of container might it be?

This looks very wrong to me.
How did you install Node-red?
What user account did you use to install it?

This is an odd, non-standard location and would have required root/sudo to install there I think. /var/lib sub-folders should not, I think, be used as live folders, they are system folders AFAIK.

Actually, thinking about it and having tested my own install, I think that having the working directory as the Node-RED installation folder should be considered a BUG. I'll raise a separate thread to have it discussed.

Anyway, the location is non-standard but does not look like a container folder and does not look like a standard npm or Dave's script install either. So to sort this out, as jbudd has asked, we need to know how Node-RED is installed. Without that information, I doubt we can help much more.

Hi everybody,
it is an industry automation system based on raspberry pi 4 debian 12 bookworm with a preinstalled node-red 4.09.
Thats the reason I don't know how it was installed.

Maybe I'll try in the kunbus forum, they'll know how it was istalled.

thanks for your help!

If you have access to the settings.js file, you should be able to reset the working folder to something more sensible as Node-RED starts up.

But overall, I would suggest raising a bug with the vendor of the system.

I've also raised a suggestion for Node-RED itself to take better control - we will see if that gets any traction with the core devs.