Search code examples
node-red

Run Node Red as SU on boot


I would like to use Port 502 for my ModBus Server Flow, however, I can only do this if I run "sudo node-red-start"

I have it set to run as a service using "sudo systemctl enable nodered.service" However, this only seems to execute it as a normal user.

Thanks


Solution

  • Running systemctl with sudo has no bearing on what user the resulting service is run as. That is defined in the service file.

    You need to edit nodered.service file and update the User and Group settings.

    ...
    [Service]
    Type=simple
    # Run as normal pi user - feel free to change...
    User=pi
    Group=pi
    WorkingDirectory=/home/pi
    ...
    

    That file should be located in /lib/systemd/system/nodered.service.