But OP doesn’t have a problem with the user or credentials. The OP has a problem with putty accepting and remembering that they accepted the remote RPi’s cert.
OP is successfully able to ssh to the client machine using putty from the command prompt so, for the purposes of the original problem, it’s irrelevant. OP already knows to do this and is doing it and it is not related to the problem.
You are confusing which user is relevant here. The user on the remote RPi is irrelevant for the problem in the OP. You can use any login name. But until the user on the Windows machine accepts the certificate from the remote RPi ssh will not allow the connection to take place and it fails before any user authentication has a chance to take place.
The problem is putty is not remembering that the OP has accepted the RPi certificate when he runs the command from the command prompt and it asks for it again when it’s run from openHAB.
What you say is true. But it’s completely irrelevant to solving OP’s problem and OP already knows to do this.
executeCommandLine('"C:\Program Files\PuTTY\putty.exe" -ssh openhabian@192.168.2.10 -pw "MYPASSWORD1234!" -m checkip')
There is no such thing as an “openhabian” user on Windows unless you’ve gone out of your way to create one, which is a lot of work and unlikely to have occurred.
Which is the exact problem. It doesn’t remember that the user has accepted the remote RPi’s certificate so it keeps asking for it and there is no way to supply the “y” when running the command from the openHAB running on Windows.
You can use putty from a command prompt without the GUI. See the command above.
So Kim is right, ssh and plink.exe are completely different. ssh will cache the certificate in C:\Users\<username>\.ssh\known_hosts
. PuTTY, on-the-other-hand, stores the certs in the registry. Have you tried running plink.exe without the extra options? Also, your original post showed you using putty.exe, and here we see you using ssh and plink. Which is the one you want to use? I believe either ssh or plink.exe are what you should be using, but you need to choose one and stick to it.
What you might need to do is connect to the machine using the PuTTY GUI first and accept the cert through the dialog and then perhaps plink.exe will work.