Hi,
I have a script to reboot my router. I have setup RSA keys and copied the public key I generated on openhabian RPi to the router setiings.
ssh -i /home/openhabian/router_keys/openhab.id_rsa username@IPaddress reboot
this all works when run from console and my router reboots
/etc/openhab2/scripts/reboot_WAN_Router.sh
but when it is run via a rule like this:
rule "Reboot WAN router"
when
Item Reboot_WAN_Router changed from OFF to ON
then
val results = executeCommandLine("/etc/openhab2/scripts/reboot_WAN_Router.sh", 10000)
logInfo("Network", "Results:\n" + results)
end
I get this error in the log:
Results:
Load key "/home/openhabian/router_keys/openhab.id_rsa": Permission denied
Permission denied, please try again.
file permissions are as follows
-rw------- 1 openhabian openhabian 1823 Oct 29 15:09 openhab.id_rsa
-rw-r--r-- 1 openhabian openhabian 400 Oct 29 15:09 openhab.id_rsa.pub
I didn’t find a solution so far. Any ideas how to fix it?
My end goal is to reboot the router if it goes offline. I have the offline detecion part working