Does Debian 12 only accept ssh connections that use certificates?
Just found this and it includes a solution for your problem:
https://community.home-assistant.io/t/remote-ssh-command-error-255/187891
Hmmm, readingā¦
did a sudo systemctl status ssh
I get an
Accepted password for trevor from 192ā¦
but
Failed password for homeassistant from 192ā¦
getting closer
So what if you replace user homeassistant with user trevor in the shell_command and sudoers file etc?
same error
So I believ we are back to certificates- Please read the community discussion above.
Thanks
Iām throwing in the towel here, I tried but doubt that it was correct to generate id_rsa & idrsa.pub files
Added them where I think was correct, but HA is a different setup depending on the Linux OS and the PC setups, so nothing is clear
And still canāt get it to work
Iām giving it up as an Ć©chec as I see many others have through out the forums
Its a great shame, either Iām to stupid or HA is too āoverā complicated, probably both
Thanks a lot for trying to help me on this
Trevor
Donāt give up to early. Please give another, maybe final try. Iāll provide you with instructions asap.
your to kind
hereās what I did
mkdir -p $HOME/.ssh
chmod 0700 $HOME/.ssh
ssh-keygen -t rsa
In the new /home/trevor/.ssl folder I copied the contents of the id_rsa.pub onto the authorized_keys file
Then added to /usr/share/hassio/ssl (the ssl folder existed already)
both the id_rsa.pub & id_rsa files as not sure which one goes where
rebooted everything
Now I get a error 2 and no longer an error 225
Error running command: ssh -i /usr/share/hassio/ssh/id_rsa ssh [email protected] sudo shutdown -h now'
, return code: 2
If I now run the
sudo systemctl status ssh
I no longer get the
Failed password for homeassistant from 192ā¦
Follow this. The process is to generate the keys within the HA docker container and then copy them to the host into the correct directory. I hope I didnāt miss anthing. My system is different so I cannot try every step myself. But this should work because I used it sometime in the past.
1. Create user homeassistant if not already done
2. Add homeassistant to sudo group: $ sudo usermod -aG sudo homeassistant
3. Modify the host sudoers file to allow the homeassistant user to skip typing the password when connecting via ssh and running sudo.
$ sudo visudo
Add the following 2 lines to the user privilege section:
homeassistant ALL=(ALL) NOPASSWD:ALL
%sudo ALL=(ALL) NOPASSWD:ALL
4. Save the file.
5. Login to the home-assistant container (note: home-assistant is the container name. check if your container has the same name or change it in the following command. Check with ādocker psā command for the right name.
$ sudo docker exec -it home-assistant /bin/bash
So now you are logged into the HA OS. Note you could also install the Advanced SSH & Web Terminal add-on instead, open a terminal and execute the following steps. But this is faster, no add-on needed.
6. Generate sshkey
$ ssh-keygen -t rsa (press enter, enter, enter)
7. Copy the sshkey to your host
$ ssh-copy-id [email protected] (type password when prompted)
8. Test ssh connection with sudo:
ssh [email protected]
Hopefully you are now logged into the host OS. Please say yes!
If this works then your shell_command should also work.
Seems like shutting the device down that runs your HA server would be the last thing anyone would want to do. Have all additional cooling/ventilation efforts failed? If you remotely shut it down when itās overheating, how do you turn it back on? manually? You cant send a similar command to turn it on obviously.
I did that with a smart plug that I could turn on/off outside of HA.
That is what WOL is for.
It helped me one or twice when my HA system crashed for whatever reason.
Hi
Same as
starob
I did that with a smart plug that I could turn on/off outside of HA.
I do that with a non zigbee device, smart plug running Tuya, so when cooler I can reboot the PC from a distance
gotcha. It might be time to use different hardware my friend. This would drive me nuts if i had this problem.
OK, that would be another way. But you can use remote ssh for not only shutting down the host but for any other host command, like restarting processes or other containers etc. So it might still be helpful.
BTW: I think neither. The issues here are coming from the fact that you have a very special use case and that HA is running in a container so it has very limited access to the resources on the host. Because of that we have to used ssh and certificates. So at the end, security is making this more complicated.
Oaky
managed all that can ssh from this pc using ssh 192.168.1.40 (as before) or ssh [email protected]
doesnāt solve the shutdown problem though, though now not sure what I should use in my /config/shell_commands.yaml
Crazy, that I am already, two days on this dopey problem, later Iāll be able to place the small no fan Zotac PC in a normal room that doesnāt get like a sauna