The command executes (wol works just fine) but the ssh command gives following error:
The authenticity of host '192.168.1.201 (192.168.1.201)' can't be established.
ECDSA key fingerprint is 53:08:a3:18:e4:34:4d:25:a0:aa:33.
Are you sure you want to continue connecting (yes/no)?
It means the host is not a āknown hostā to ssh. If you try to ssh to the same host from the command line and the same user as OH, you should see a similar message. Approve
the host and ssh will remember it when the OH server uses ssh to access it.
Hi, thanks for your answer. The strange thing is I use my laptop to make configurations on my server with ssh. So iām logged on to my server as server@server. In that session I can connect to htpc@192.168.1.201 because itās a know host to my server. When I startup openhab with the sh command, and try to ssh to htpc@192.168.1.201 it gives the error that Iāve written above. Obviously iām doing something wrong, but canāt figure it out.
Have done ssh from my server to htpc, then from htpc back from server. Does openhab run under a diffrent user?
This is not an issue of the client not being known to the server, but it is the other way around. Here is some more informationā¦
The first time a user logs into a host, ssh will ask the client to verify the the server key. If verified, it will store that key for future ssh sessions. The key is typically stored under the process user (openHAB server user) home directory so you must be logged in as the OH user on the OH server machine to verify the host that is the target of the ssh connection. I donāt know what operating system you are using for the server, but for Linux you could use āps -ef | grep openhabā to show the process details including the user.
If you are fine with the reduced security and just want to avoid the verification, you can try the following technique.
Thanks for your answer steve. Iāve managed to fix the problem. What iāve done:
from my server iāve executed the command (did the same thing from htpc to server) :
ssh-keygen
ssh-copy-id htpc@192.168.1.201
after this i was able to ssh without the need to give a password.
I start openhab using sudo sh start.sh. Iāve altered my permissions using
sudo chown -R server Openhab/
sudo chmod -R 775 Openhab
This enables me to start openhab using the correct user (server). Before this, it was opening openhab as root and I couldnāt ssh login without giving a password.
Then I altered my shutdown command using:
ssh htpc@192.168.1.201 sudo shutdown -h now
Iāve added the -h parameter because else ubuntu wouldnāt shut down properly. After this you have to edit the /etc/sudoers file. Because you need to be root to shutdown I have to give the htpc user root acces to shutdown ubuntu. This is done by using:
sudo visudo
#add the following line:
htpc ALL=NOPASSWD: /sbin/poweroff, /sbin/start, /sbin/stop
I had the same problem, running ssh myuser@remote-host mkdir test from the openhab server terminal would execute OK. But executeCommandLine("ssh myuser@remotehost mkdir test") was not executed by openhab.
Note the last step must be ssh-copy-id -i ~/.ssh/mykey.pub myuser@remote-host if you want to use āmyuserā on the remote host! Good to know if you want to connect to an OpenWRT router: you need to paste the public key via Luci in system->administration instead of using the ssh-copy-id method! Also note you can login using a specific key with ssh -i /root/.ssh/mykey myuser@remote-host
Hi, Iām on mac os and i try to do that but i alway have this :
The authenticity of host āthib5.com (192.168.111.2)ā canāt be established.
ECDSA key fingerprint is SHA256:poTIcrXvQ7JDGj2DSJ8ieGDXs2KZzhad0dFNYP2of2s.
Are you sure you want to continue connecting (yes/no)?