0

I try to start a mintty instance (running ssh) with a ruby script. When ssh asks for the password i would like to enter the password with the script. I've tried the following:

f = IO.popen("C:/.../cygwin/bin/mintty.exe /usr/bin/ssh user@host", 'r+')
f.puts "password\n"
f.close

When i execute this code ssh is started in a new mintty window. but the password is not recognized. I am not even sure if it reaches the STDIN of this process. Any ideas?

Benedikt Bock
  • 1,007
  • 15
  • 37
  • Can you try running that command from the command line and experimenting? Does Windows have something like `echo foo | command` or `command < filename` in Unix? – Keith Bennett May 26 '16 at 18:04
  • Windows itself does not have this ability. In mintty I can run `echo foo | ssh -t -t user@host`. But in this case foo is not piped to the password prompt. It is piped to the ssh session. That mena s I will get something like this after login: `user@host $ foo` – Benedikt Bock May 26 '16 at 18:16

0 Answers0