Score:0

Let an unattended script connect from windows to an applaince with ssh password

tr flag

I'm creating a script that will run unnatended on Windows. The script needs to execute commands via SSH on an appliance. The appliance does not support public/private key authentication only password authentication is supported. The script will need to execute some commands via SSH and capture the results (via stdout). The script will be run on Windows and will use built-in Windows SSH Client, this is preferred for the compliance reason, but if a different client can do the job I would also like to know.

I need a way to bypass the password propmpt, so that the password is supplied by the script. How can this be achieved?

What I have considered:

  • Public Key Authentication - is not supported by the appliance
  • Use putty - needs to be completelly unattended
  • sshpass - does not work on windows
  • WSL - requires Hyper-V and the machine has VmWare on it which is incompatible, also was hoping for something simpler
in flag
There are some Powershell SSH implementations you might be able to use.
tr flag
@Zoredache Thank you. There is only one, and this is the one I linked in the question. It is the same as [this](https://github.com/PowerShell/openssh-portable) and [this](https://github.com/PowerShell/Win32-OpenSSH/releases) If there are others, please let me know. Also would be interesting to learn, what in those implementations you mentioned would help.
in flag
I was thinking of something like Posh-SSH which uses the .NET ssh library instead of OpenSSH. https://github.com/darkoperator/Posh-SSH https://github.com/sshnet/SSH.NET
Score:1
cn flag

Would the tool 'expect' be an option for you? As far as I know it runs on Linux but is also ported to Windows. Using this tool you can capture output and react on it with eg. some input. Maybe this post addresses your need: https://hostadvice.com/how-to/how-to-automate-tasks-in-ssh/

tr flag
Unless there is any particular implementations that you know are working, I cannot use this answer. I tried a few but they do not work. In particular [zetamatta/expect does not redirect output](https://github.com/zetamatta/expect/issues/16) and all download links from [Expect for Windows](https://wiki.tcl-lang.org/page/Expect+for+Windows) are broken.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.