Controlling ssh from an external program

Darren Tucker dtucker at zip.com.au
Thu Oct 21 07:20:41 EST 2004


Jeff Anderson (by way of Jeff Anderson <jander at hundredacrewood.org>) wrote:
> I am working on a remote administration tool, and I would like to be able to 
> control ssh/scp via an external program. I know the standard answer to this 
> is to use expect, however this is NOT an option.
> 
> The next standard answer is to use an empty passphrase or ssh-agent, but I 
> cannot guarantee that the remote system will have a keypair, so I need to be 
> able to fallback on password authentication if that fails. The controlling 
> program needs to be able to feed the password to ssh/scp.  
> 
> 
> Additionally, I can only use an unmodified version of openssh (i.e. whatever 
> version is available on the system that the admin tool is run from).
> 
> Any ideas?????

Abuse the SSH_ASKPASS mechanism, eg:
http://marc.theaimsgroup.com/?l=openssh-unix-dev&m=109822418603321

Alternatively, have your tool allocate a pty, run ssh with the pty as 
its controlling terminal and then feed the password to the pty (yes, 
this is reinventing the wheel called "expect").

-- 
Darren Tucker (dtucker at zip.com.au)
GPG key 8FF4FA69 / D9A3 86E9 7EEE AF4B B2D4  37C9 C982 80C7 8FF4 FA69
     Good judgement comes with experience. Unfortunately, the experience
usually comes from bad judgement.




More information about the openssh-unix-dev mailing list