I found the following excerpt on this site and was hoping to
get some help. I’m trying to replace TELNET invocations in some “C”
code with SSH invocations. The server side will not accept public key
encryption, so I will be prompted for the password. I’m trying to figure
out how to redirect the password prompt from the terminal to my application
program. I saw in the excerpt below that this could be done using pseudo
terminal within the child process of my program. Can someone show me a snippet
of code on how to do this?? Thank you.
> On the other hand, I think it would not be necessary to make SSH accept all
> input on it`s stdin, would it ? The passphrase should be sufficient.
I don't understand. SSH already accepts all input of the remote program
on stdin. Only password, passphrase and confirmations (e.g. for unknown
host key) are asked on /dev/tty.
> I tried to examine the code of OpenSSH 2.3.0p1 and to insert an -I
> switch, but it seems to be quite complicated to me.
> BTW, who did "invent" this switch ? Google left me completely clueless.
I think it was Pavel Machek. But the problem with such patches is that
they have a very limited audience. Very small percentage of MC users will
recompile ssh just to get FiSH to work with passwords.
And most importantly, it is not needed. It is possible to redirect
child's /dev/tty from a C program by using pseudoterminals, although I
don't know how to do it in the shell.