# Shutdown or Restart Remote Linux Devices

**URL:** <https://discourse.nodered.org/t/shutdown-or-restart-remote-linux-devices/81523>\
**Category:** General\
**Created:** [23 September 2023 17:35 UTC](https://discourse.nodered.org/t/shutdown-or-restart-remote-linux-devices/81523 "2023-09-23T17:35:44Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![corin.corvus](https://avatars.discourse-cdn.com/v4/letter/c/7feea3/32.png) [@corin.corvus](https://discourse.nodered.org/u/corin.corvus)\
**Post date:** [23 September 2023 17:35 UTC](https://discourse.nodered.org/t/shutdown-or-restart-remote-linux-devices/81523/1 "2023-09-23T17:35:44Z")

</div>

Hi,

at the moment i try to find out how i can use Node-Red Dashboard with Buttons to shutdown oder Restart remote Servers. I found some threads, but no one helped me for a solution.

the Flow must do:  
Login via ssh on the Device with username and password  
execute shutdown Command.

do anyone have a flow for me?

Thanks

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [23 September 2023 18:07 UTC](https://discourse.nodered.org/t/shutdown-or-restart-remote-linux-devices/81523/2 "2023-09-23T18:07:03Z")

</div>

Setup ssh to use keys, not user/pwd, then it is much easier.

---

<div class="post-metadata">

**Author:** ![corin.corvus](https://avatars.discourse-cdn.com/v4/letter/c/7feea3/32.png) [@corin.corvus](https://discourse.nodered.org/u/corin.corvus)\
**Post date:** [23 September 2023 18:09 UTC](https://discourse.nodered.org/t/shutdown-or-restart-remote-linux-devices/81523/3 "2023-09-23T18:09:21Z")

</div>

i cant do it on the machine. this ssh server is very dump and not support ssh keys.

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [23 September 2023 18:28 UTC](https://discourse.nodered.org/t/shutdown-or-restart-remote-linux-devices/81523/4 "2023-09-23T18:28:24Z")

</div>

Write a script (python?) to run all the time on the server which subscribes to an MQTT topic and reboots.

Or, install Node-red, same MQTT topic, and reboot via an exec node.

---

<div class="post-metadata">

**Author:** ![edje11](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/edje11/32/572_2.png) [@edje11](https://discourse.nodered.org/u/edje11)\
**Post date:** [23 September 2023 20:10 UTC](https://discourse.nodered.org/t/shutdown-or-restart-remote-linux-devices/81523/5 "2023-09-23T20:10:14Z")

</div>

I'm using myself [node-red-contrib-ssh-coco (node) - Node-RED](https://flows.nodered.org/node/node-red-contrib-ssh-coco) to shutdown remote server.  
However my experience is the same as from Colin that using a ssh key was also with this node the most reliable way.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [24 September 2023 00:51 UTC](https://discourse.nodered.org/t/shutdown-or-restart-remote-linux-devices/81523/6 "2023-09-24T00:51:48Z")

</div>

Agree with @jbudd that running a service on each remote is the best approach. Though, of course, security is still an issue.

There are all sorts of admin tools out there that will expose REST API's as well so that you can issue a command remotely. But running Node-RED is one pretty simple way.

---

<div class="post-metadata">

**Author:** ![corin.corvus](https://avatars.discourse-cdn.com/v4/letter/c/7feea3/32.png) [@corin.corvus](https://discourse.nodered.org/u/corin.corvus)\
**Post date:** [25 September 2023 13:59 UTC](https://discourse.nodered.org/t/shutdown-or-restart-remote-linux-devices/81523/7 "2023-09-25T13:59:01Z")

</div>

Cant install anything on this servers. its a system like a container with no installs or repos. only flashed by image with simple ssh access. The only i can change is username and password of ssh user. also only 10gb hdd storage with 8,9gb full.

---

<div class="post-metadata">

**Author:** ![jmorris644](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jmorris644/32/31964_2.png) [@jmorris644](https://discourse.nodered.org/u/jmorris644)\
**Post date:** [25 September 2023 14:52 UTC](https://discourse.nodered.org/t/shutdown-or-restart-remote-linux-devices/81523/8 "2023-09-25T14:52:24Z")

</div>

As mentioned earlier, I do this with a simple MQTT topic and an Exec node. No need for ssh at all.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [25 September 2023 15:07 UTC](https://discourse.nodered.org/t/shutdown-or-restart-remote-linux-devices/81523/9 "2023-09-25T15:07:51Z")

</div>

The guy can't install anything, so can't use mqtt.

---

<div class="post-metadata">

**Author:** ![jmorris644](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jmorris644/32/31964_2.png) [@jmorris644](https://discourse.nodered.org/u/jmorris644)\
**Post date:** [25 September 2023 15:19 UTC](https://discourse.nodered.org/t/shutdown-or-restart-remote-linux-devices/81523/10 "2023-09-25T15:19:29Z")

</div>

Ah, so node-red is NOT on those machines? If true, then I misunderstood.

@corin.corvus Would doing a reverse ssh help?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [24 November 2023 15:19 UTC](https://discourse.nodered.org/t/shutdown-or-restart-remote-linux-devices/81523/11 "2023-11-24T15:19:39Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
