Hi,
I was wondering if this was resolved?
I’m having a similar problem, which I can’t quite nut out…
I’m running HA in a Linux Docker (HASSIO).
I’m just wanting to do a remote shutdown Octoprint on an RPi via an entity switch.
The switch config is:
I can SSH into the HA docker and manually run the command okay. It works this way. I am however logging in as root when done manually. Not as the HA user.
I’ve gone looking for a HA user - can’t find anything that might be… I’ve issued the following command to look:
I am trying to log in as ‘pi’ anyway?
I’ve enabled password-less access into the Pi by setting up key pairs. Works when I manually log via the HA CLI.
Hi,
Thanks so much for replying. This is has been bugging me no end.
I did think your post did answer my problem.
Here’s what happened, this from my HASSIO host (on docker), logging in as root:
cd /config
mkdir ssh_keys
cd .ssh
cp private_key.ppk /config/
cp private_key.ppk ./ssh_keys/
chmod 700 ssh_keys/
chmod 600 ssh_keys/private_key.ppk
rm private_key.ppk
$ ssh -i /config/ssh_keys/private_key.ppk -o 'StrictHostKeyChecking=no' [email protected] sudo /sbin/shutdown -h now
Load key "/config/ssh_keys/private_key.ppk": invalid format
[email protected]'s password:
I ENTERED THE P/WORD…
Connection to 192.168.1.237 closed by remote host.
I GUESS IT SHUTDOWN AT THIS POINT
When I go via the HASSIO CLI I can ssh to Octoprint CLI without password:
$ ssh [email protected]
Linux octopi 4.19.75-v7+ #1270 SMP Tue Sep 24 18:45:11 BST 2019 armv7l
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
BLAH BLAH BLAH
I tried this on the Octoprint server today for good measure (being quite clueless probably):
$ sudo visudo
added:
pi ALL=(ALL) PASSWD: ALL
This is probably a massive security hole, but I’m trying everything!
Am I best off to try and issue CURL commands to PUT directly to the Octoprint server? Seems to be a popular approach from what I can see…
But it works!
Even though I had password-less access between HASSIO docker and RPi (Octoprint), I needed
a private key with an OpenSSH format,
to be explicit with the key I wanted to use (and don’t be strict with host checking) and
my syntax was a bit wonky…
Could I have perhaps used an OpenSSH compliant key-pair in the first instance, left off the explicit path (use the .ssh path by default), still told it not to be strict with host checking?
In any case I’ve got it work (allbeit with an error)…
THANK YOU!
I can´t get ssh to my Synology to work. Get permission denied error when trying from Putty when logging in with the user pi. Is the / config/ folder just the folder where all the YAML files are? I am not on Hassio.
What is the exact procedure for copying the private key from another pc to HA?
I use this command from cmd:
scp c:/users/jesper/.ssh/id_rsa.pub [email protected]:/home/homeassistant/.homeassistant/ssh/id_rsa
Afterwards I then change the permission for the ssh folder to 700.
I guess there might be some user/permission issues but can´t figure out what
Originally I created the keys in CMD on my Win 10 pc.
I can log in to my Synology now without password from CMD on that pc.
I thought that I just had to copy the private key to a folder in the /config/ folder and use ssh i in the command line in HA.
When I use this command in CMD on the local computer it returns:
‘ssh-copy-id’ is not recognized as an internal or external command,
operable program or batch file.