Way to trigger a Synology NAS to shutdown using HE

From my understanding, a Synolgoy NAS can only be shut down using SSH, not a regular HTTP command.

That is my understanding as well.

If not using HE directly, could this be done using Node-Red ? I see alot of posts talking about Node-Red but I have no idea if this could help with shutting down a NAS

I put in a feature request for a SSH client but it has not yet been fulfilled (or officially commented on). Right now you would have to setup some kind of relay; a node server or something with a HTTP interface that does the SSH for you after that. Maybe somebody knows of an existing project like that.

From a Linux box, as long as you're running Key only authentication ssh on the synology, you can certainly script an ssh connection. If you set up a netcat listener for a get or post, and then launched said script, it would seem doable using a pi....

I expect a better bash ninja then I could handle Passworded ssh keys as well.

S.

May I ask what the use case is? Just curious, as I have mine reboot daily using DSM. After a daily backup to an external connected drive, I set the drive to disconnect so that my backed up data isn't connected until it's time to backup. This keeps my backed up data less vulnerable, should an attacker find a way in.

Just before the scheduled backup time, I have DSM configured to reboot the Synology. This remounts the drive and then shortly after the backup proceeds and the cycle repeats.

Since my UPS is not listed in Synology's compatible UPS list, I need a way to shutdown the NAS safely and probably hubitat also when I have a power outage. Wright now I have everything on that UPS so I would use a contact to trigger a RM rule in Hubitat to send a command to the NAS to shutdown and then shutdown Hubitat also.

Have you tried hooking the USB wire to the NAS? None of my UPS’s have been on the Qnaps list (I don’t have a Synology) either and they have all worked. You can verify things by hooking it up and looking at the UPS details in the Synology UI and testing it there.

This is how I do it with node-red.

[{"id":"b9b8bf6d.f2539","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"d1b76b2a.8520d8","type":"wake on lan","z":"b9b8bf6d.f2539","mac":"00:11:32:24:EB:97","host":"192.168.1.255","udpport":"9","name":"Turn On Synology NAS","x":393,"y":186,"wires":[]},{"id":"6a1fba04.b69524","type":"bigssh","z":"b9b8bf6d.f2539","name":"Power Off","commandLine":"poweroff","commandArgs":"","minError":1,"minWarning":1,"noStdin":false,"format":"","payloadIsArg":false,"myssh":"b961ca46.1db418","x":343.93938064575195,"y":234.98486804962158,"wires":[[],[],[]]},{"id":"5750f5da.99a17c","type":"switch","z":"b9b8bf6d.f2539","name":"","property":"payload.content.value","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"},{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":92.44441986083984,"y":209.11111545562744,"wires":[["d1b76b2a.8520d8"],["6a1fba04.b69524"]]},{"id":"b961ca46.1db418","type":"SSH_Credentials","z":"","host":"192.168.1.85","port":"2222","userlabel":"root@192.168.1.85"}]

1 Like

thank-you @JBrown !

I'm just starting with Node-red but this is great motivation to get going

@ritchierich

I haven't tried hooking it up with USB since the software that comes with the UPS seems windows specific. I also would like to control the NAS powerup/shutdown with more flexible events.

Yes the software that the UPS manufacturer provides is windows specific but Synology, Qnap, and others have the Network UPS Tools (NUT) software pre-loaded. Sure you may not have a ton of options here is a screenshot of my settings, but your NAS will shutdown automatically and you can also integrate your HE hub to then perform other actions too:

The UPS driver in the above thread works for Synology too as confirmed by several other community members.

1 Like

@JBrown

~~I tried your code (Thanks again) but I get "Error: All configured authentication methods failed" :thinking:

I'm using a DS1019+, I get the error in Node Bigssh Credentials are "root@ip adress" + password, using port 2222. I don't see what could be different then yours

@yannick00000

I set this up a long time ago, don’t remember everything.
Have you enabled SSH from DSM -> Control Panel -> Terminal (IIRC), also give it the same port number you are using in Big SSH.

@JBrown

Yes, I've enabled SSH and port 2222.

I will look into this tomorrow, I think the problem is on the Synology side.

This thread may help you.

I'm getting the same error. I suspect, and I'm not prepared to change it, it's because I've disabled root/admin user in the Synology NAS, as it's insecure. You must use root user to poweroff via ssl in synology nas.

I've enabled Admin/Root and it doesn't work so it's something else but I just can't find it, it's not like there's ton of options. If only I knew what "Error: All configured authentication methods failed" meant and where it's coming from

Did you enter a password into the ssh node in node-red for root? I believe it should be the same as the your admin password.

If that does not work I think you need to modify your sudoers file.

I believe I used Putty to log into my nas.
cd /etc
sudo vi sudoers
Add the following line to allow root to execute any command.
root ALL=(ALL) ALL
save the changes using :wq then reboot the nas.

Hi @JBrown,

I checked the sudoers files and "root ALL=(ALL) ALL" is already in there.

Thanks for the suggestion, I didn't even know about that config file

In the Node I have root as username and my root password. I tried my admin password but that doesn't work also.

@JBrown

I also tried to enter the admin password using "root@ip address" and that didn't work