AlexGustafsson / homebridge-wol

A Wake on Lan plugin for Homebridge
MIT License
296 stars 30 forks source link

ssh keeps asking for passphrase #236

Closed abhiiously closed 1 year ago

abhiiously commented 1 year ago

Backstory

I followed this tutorial to get ssh working on homebridge-wol on Unraid, albeit the only way I can get it to put my computer to sleep is to have ssh-keygen create a key without a passphrase which I know is unsafe.

Issue

I keep getting "Enter passphrase for key '/homebridge/id_rsa': " when I manually run the ssh command via homebridge terminal but when I run the ssh command via homekit on my phone I get this error in the logs

"HWOL-4001 An error occurred while trying to shut down the device. This is most likely not an issue with homebridge-wol itself. For more information see https://github.com/AlexGustafsson/homebridge-wol/wiki/Frequently-Asked-Questions#hwol-4001"

Environment

- os and os version: Unraid 6.12.0-rc1
- node version: v18.13.0
- homebridge version: 1.6.0
- homebridge-wol version: 5.0.2

Configuration

{ "bridge": { "name": "Homebridge B89B", "username": "-snip-", "port": 51796, "pin": "302-91-740", "advertiser": "bonjour-hap" }, "accessories": [ { "name": "Garage Switch", "stateful": false, "dimmer": false, "reverse": false, "time": 1000, "random": false, "resettable": false, "brightness": 0, "disableLogging": false, "accessory": "DummySwitch", "_bridge": { "username": "-snip-", "port": 34710 } }, { "name": "Abhi-PC", "manufacturer": "Abhiiously", "model": "Abhi-PC", "host": "192.168.50.90", "pingInterval": 2, "pingsToChange": 5, "pingTimeout": 1, "pingCommandTimeout": 0, "mac": "-snip-", "startCommandTimeout": 0, "wakeGraceTime": 45, "wakeCommandTimeout": 0, "shutdownCommand": "ssh -o StrictHostKeyChecking=no -i /homebridge/id_rsa Abhi@192.168.50.90 \"C:\Data\PSTools\psshutdown -d -t 2\"", "shutdownGraceTime": 5, "shutdownCommandTimeout": 0, "logLevel": "Info", "returnEarly": true, "_bridge": { "username": "-snip-", "port": 55532 }, "accessory": "NetworkDevice" } ], "platforms": [ { "name": "Config", "port": 8581, "platform": "config" }, { "name": "Plex Webhooks Platform", "sensors": [ { "name": "abhikbhatia", "filters": [ [ { "path": "Account.title", "operator": "===", "value": "abhikbhatia" } ] ] }, { "name": "Abhiiously", "filters": [ [ { "path": "Account.title", "operator": "===", "value": "Abhiiously" } ] ] } ], "_bridge": { "username": "-snip-", "port": 50255 }, "platform": "PlexWebhooks" }, { "name": "TplinkSmarthome", "addCustomCharacteristics": true, "switchModels": [ "HS200" ], "deviceTypes": [ "plug" ], "platform": "TplinkSmarthome", "_bridge": { "username": "-snip-", "port": 52153 } } ] }

Logs

When I follow these steps:
1. Make sure `logLevel` is set to `Debug` on all `NetworkDevice` accessories
2. Run `homebridge`
3. Let it run for a couple of minutes
4. Try to turn a device on or off using the plugin
5. Wait one minute
6. Repeat step 4

I get the following log:

[3/18/2023, 3:15:54 AM] [Abhi-PC] [NetworkDevice] Attempting to shut down the device using "ssh"
[3/18/2023, 3:15:54 AM] [Abhi-PC] [NetworkDevice] HWOL-4001 An error occurred while trying to shut down the device. This is most likely not an issue with homebridge-wol itself. For more information see https://github.com/AlexGustafsson/homebridge-wol/wiki/Frequently-Asked-Questions#hwol-4001
[3/18/2023, 3:15:54 AM] [Abhi-PC] [NetworkDevice] Error: Command failed: ssh -o StrictHostKeyChecking=no -i /homebridge/id_rsa Abhi@192.168.50.90 "C:\Data\PSTools\psshutdown -d -t 2"
Permission denied, please try again.
Permission denied, please try again.
Abhi@192.168.50.90: Permission denied (publickey,password,keyboard-interactive).


### Notes

_No response_