when installing Node-RED, i did it on an raspberryPi and used the default user "pi"- Now, I disabled the login of this user and use a different user name to login for security reasons. Node-red still works fine, but:
When I use the exec node to run a shell script and write "whoami" in the script, it says "pi". How can I change this to my current user - so change the user Node-RED uses?
If you run sudo systemctl status nodered
it will tell you where the service file is. Note there is no dash in nodered.
An alternative to changing it manually is to login as the new user and then run the node red install/upgrade script again. That will replace the service file with one for the correct user. It will also upgrade node red to the latest of course.
How are you making it pick up the correct .node-red folder? That is also defined in that service file via the user name.
If node red is still running as the user pi then it should be picking up the folder from /home/pi, not the new user. What I meant was how are you telling node red to use the new user's .node-red folder?
The "whoami" in the script tells now it used the new user, that I set in the nodered.service file. Which folder it uses - I didn't care as long as it works.