Hi there,
I am desperately trying to use Node-Red to shutdown or restart my Debian system.
Was trying to use the exec node with the command: sudo shutdown now
And even though I used sudo visudo
to add the permission to run this command without password, it doesn't run successfully.
Node-Red always tells me it's missing the rights for this command to execute.
tried both variants:
'user_name ALL=(ALL) NOPASSWD: /sbin/poweroff, /sbin/reboot, /sbin/shutdown'
or
'ALL ALL=(ALL) NOPASSWD: /sbin/poweroff, /sbin/reboot, /sbin/shutdown'
As it's a Debian system I used the convenient script to install Node-Red under my user account, no root account.
ps axu
tells me the systemd of Node-Red is running under my username.
Maybe the underlying node.js is running as a different users process and that's why it's not being granted the privileges to run the shutdown command?
Node-Red error message:
"sudo: no tty present and no askpass program specified"
Tried to run sudo -S shutdown now
and this looked good at first, but then the process just waits forever for the password from stdin... process owner is root in this case... should be the normal user right?
I hope someone here knows how to just simply shutdown the local machine when a certain flow is triggered. Can't believe nobody ever has had this issue before.
Hope you guys can shed some light and help me with my problem.
Thanks!
Newbow