So I am wondering if it is possible to send a command via SSH and get a return from a windows cmd session through PUTTY to a RPI.
What I am doing now is that i run a check IP from one Rpi to another Rpi and it return the IP address.
This works great on Linux because i have sshpass and it works flawless.
The server's host key is not cached in the registry. You
have no guarantee that the server is the computer you
think it is.
The server's ssh-ed25519 key fingerprint is:
ssh-ed25519 255 aa:4d:aa:a4:aa:31:68:a2:6b:aa:52:ae:67:6d
If you trust this host, enter "y" to add the key to
PuTTY's cache and carry on connecting.
If you want to carry on connecting just once, without
adding the key to the cache, enter "n".
If you do not trust this host, press Return to abandon the
connection.
Store key in cache? (y/n) Connection abandoned.
Does anyone know how to input a y to accept the connection? When running this through command line I already accepted it and it is still asking to accept the connection.
Under Windows 10 you have now the possibility to activate the Linux Subsystem for Windows (WSL) - with that you would be able to use ssh commands from the command line without using Putty. Maybe that would help?
First, just try connecting to the server without everything from -pw onward. You should be able to press y. That will store the key in your registry and that won’t come up next time you run it. If that won’t work, connect using the PuTTY UI, accept the cert and then try the command from the shell.
In addition to the WSL, MS now provides a native version of openSSH which is handy if you want to use the VSCode Remote SSH extension (let’s you edit files on a remote machine through SSH). See https://docs.microsoft.com/en-us/windows-server/administration/openssh/openssh_install_firstuse. Then you can use ssh from cmd or PowerShell like you are used to from Linux or Mac. The only limitation I’ve found with it so far is it doesn’t support ProxyCommand (i.e. you can’t tunnel through multiple SSH hops automatically).
Based on the OP, the user is running ssh from a Windows box to the openHAB box. There is no openhab user on the box the ssh is initiated from. The user on the Windows box is irrelevant and I assume it’s the user’s normal login. The command they are trying to run is using user openhabian which makes sense as you cannot ssh into the openhab user (nor should you be able to).
So running the command where you can pretty the y for the current user should be sufficient.
But to answer your question, it is per user, not global.
I read that as them running the ssh command from a rule, and now that it is on Windows, the ssh fails.
If openhab on Windows runs as an openhab user, that will be the user they need to log in as to hit ‘y’ on manually. I assumed they had done it as their usual account and the openhab user still needed approval.
Does openhab run as a different user on Windows? I don’t know.
I cant tell… Maybe ssh is disabled from your policy at work? (at my work everything seems disabled)
I would assume ssh beeing installed by default on all pro windows 10. I dont see why it shouldn´t. It is a “pro” utility.
I have already accepted and hit y when running from commandline. It is only when it runs from the rule it asks to hit y to accept and shows that in the logs.
The SSH is an optional windows feature and you have to install it separately. The list of optional features includes an OpenSSH-Client (= ssh) and also en OpenSSH-Server.
You would not have an openhabian user on your Windows machine.
I don’t know how Windows manages openHAB as a service and whether the installation instructions have you create a new user to run it under or not. I don’t think it does meaning that I’d expect it to be running under your login name.
But if you’ve accepted the cert from your RPi from the command line, then it should be accepted for your login user whether or not it’s you at the command line or openHAB running. Maybe you need to restart openHAB after pressing “y” at the command prompt.