Yes! Seems like login Happened!
But not working yet.
Now I get:
stdout: ""
stderr: "bash: line 1: poweroff: command not found"
returncode: 127
In config.yaml i have:
shell_command:
shutdown_tnas: ssh -i /config/.ssh/id_ed25519 -o 'StrictHostKeyChecking=no' -p 9222 [email protected] poweroff
Try using the full path, like /sbin/poweroff or something like that⌠To find where is the command, use âwhich poweroffâ from an interactive ssh session of the NAS.
1 Like
You may also want to SSH from the HA CLI and run âwhoamiâ to make sure itâs logging you in as the correct user.
1 Like
Guys, it worked!
I donât really know how to thank you for all the help you gave me and patience you showed.
I donât even really know which reply to mark as solution.
Thanks forever and ever and ever and everâŚ
P.s.
To be thorough, in case anyone else will ever need this, NAS warned me that âshutdownâ should be used instead of âpoweroffâ
2 Likes
Finally the solution was brought by @FriedCheese and @blackfede. Thanks, you made this a great day.
To summarize:
-
Install and activate ssh on both HA and NAS.
-
Access HA cli and generate keys with
ssh-keygen
donât set passphrase and when prompted for file path:
-
Type: /config/.ssh/id_rsa.pub
-
Copy the generated keys to NAS using:
ssh-copy-id -i /config/.ssh/id_rsa.pub user@NAS_IP
using your credentials.
-
Run:
chmod 600 /config/.ssh/id_rsaâ
-
Create a shell_command entry in config.yaml:
shell_command:
shutdown_nas: ssh -i /config/.ssh/id_rsa -o 'StrictHostKeyChecking=no' -p 9222 user@NAS_IP /sbin/shutdown
using your credentials.
- Restart HA
Now you should be able to call a service called: shutdown_nas
This way, I got rid of the need for a smart UPS.
Please correct me if I badly reported something.
If you encounter an issue, since I mistook almost everything could be mistaken, youâll likely find the brief solution among replies, so take time to and care of reading.
3 Likes
Woo! Iâm glad it worked!
1 Like
Thanks to you and @FriedCheese
1 Like
hi all!
i believe that in step 3 we have to remove the âpubâ extension.
using core 2024.9.3
no luck here⌠getting the error below when try to run action from developer tools:
stdout: ""
stderr: "Warning: Identity file /config/.ssh/id_rsa not accessible: No such file or directory.\nPermission denied, please try again.\r\nPermission denied, please try again.\r\[email protected]: Permission denied (publickey,password)."
returncode: 255