Comments (9)
It seems to me like the issue is much simpler than you think. I think the user does not have permissions to shutdown the computer.
On your iMac, try to open the terminal and execute the shutdown command (without ssh). Youāre probably going to see a prompt for your password.
There are ways to change what commands a user can execute without sudo, try that.
from homebridge-wol.
Thanks for the response.
I enabled password-less sudo on both machines so don't think a password prompt would happen as the command was "sudo shutdown -h now" rather than just "shutdown -h now".
I tried to create an executable script on the iMac to try it a different way. I used osascript -e 'tell app "System Events" to shut down' instead of shutdown -h now as that shouldn't ask for a password.
I can run ssh 192.168.1.82 sudo ~/rmShutdown.sh via terminal on the Mac mini and it works fine. However when I try use it as the shutdownCommand command I get the same message.
[4/7/2019, 7:53:27 PM] [iMac] An error occured while trying to shut down "iMac" (192.168.1.xx): Error: Command failed: ssh 192.168.1.xx sudo ~/rmShutdown.sh
Permission denied, please try again.
Permission denied, please try again.
Received disconnect from 192.168.1.xx port 22:2: Too many authentication failures
Disconnected from 192.168.1.xx port 22
Thoughts?
from homebridge-wol.
Ensure that your SSH keys are correctly setup. If the permission issue is not on the iMac side, itās on the other side. Notice how it repeats the error message and mentions an authentication error, typical for SSH issues.
If you have setup keys for the user, ensure that the shutdown command is run by your user by testing a shutdown command like āwhoamiā.
Also, thank you for posting about your findings along the way! I like to imagine that it helps others when debugging issues.
from homebridge-wol.
Not sure if this is related but the switch always stays On even when the iMac is sleeping! The only time it shows as Off is when the iMac has been completely shut down.
from homebridge-wol.
Regarding the SSH keys. It works via terminal but not via Homebridge. Could it be that it is running as a different user? I would have thought that using username@ would have sorted that?
Maybe Iāll delete the SSH keys and start from scratch.
from homebridge-wol.
OK, so I deleted the SSH keys and recreated them and still no joy!
I can SSH via Terminal from the Mac mini to the iMac without a password and can execute the commands without issue.
However when done through Homebridge / Homekit I still get the permissions error!
Could the āPermission deniedā error be due to Homebridgeās / Nodeās ability to run the SSH command rather than authenticating with the remote server? Or am I just reaching?
I am stuck!!!
from homebridge-wol.
Regarding the first part, this is likely due to the mac responding to pinging whilst sleeping. This is a known issue without any real solution as of now. If your interested, there are other issues around discussing this further.
As for SSH keys. Yes, the decision should be automatic if you use me@...
, if you're running as the same user as SSH looks in ~/.ssh
for keys. Usually all keys are in /Users/me/.ssh
even though it may be for SSH user someone-else
. You should try to force SSH to use specific keys by using ssh -i /Users/me/.ssh/id_rsa
(or whatever your key is called) in the shutdown command.
from homebridge-wol.
Awesome, that fixed it. Thanks š
Now I just need to figure out how I am going to use it since the iMac responds to Ping whilst asleep!!!
At least I can see if it is on and shut it down using Homekit now :)
from homebridge-wol.
@guyssbrown This is a known issue due to iMacs responding to pings even when they're asleep. There are some issues you can find here which discusses the issue in depth.
When this milestone has been resolved, the issue will have been mitigated:
https://github.com/AlexGustafsson/homebridge-wol/milestone/1
Closing as this is solved. Feel free to open new issues if you stumble upon further trouble.
from homebridge-wol.
Related Issues (20)
- macOS lock HOT 2
- WoL always on, although when the device is off HOT 3
- WOL doesn't work after extended time
- Network Device Ping Status every Time offline
- Settings for mac mini running Monterey
- Sleep-On-LAN (SOL)
- Can't shutdown my computer with the shutdown command
- WOL starts device, but no ping and no Online status HOT 9
- Homebridge running on docker no sambo-common
- Check if Windows PC is sleeping
- Samba Mac
- Ask for wake/start command
- Adding plugin to HomeKit
- ssh keeps asking for passphrase
- Feature Request: Add support for pingsToChange for ping commands HOT 2
- Please add icons if possible HOT 1
- Dont wake after shutdown HOT 15
- Add instruction for Enable Printer and File Sharing W10+ HOT 1
- magic packets sent not waking pc anymore HOT 14
- Unraid: setcap cap_net_raw=pe /path/to/bin/node
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
š Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ššš
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ā¤ļø Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from homebridge-wol.