Controlling ssh from an external program

David Woodhouse dwmw2 at infradead.org
Tue Nov 2 00:39:32 EST 2004


On Thu, 2004-10-21 at 07:20 +1000, Darren Tucker wrote:
> 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

 ( In which Damien Miller writes: )
> DISPLAY=junk SSH_ASKPASS=~/.ssh/add-passphrase.sh ssh-add </dev/null

The same trick doesn't work for ssh. Unless ssh got fixed following the
recent discussions, you still need a hack which disassociates from the
controlling tty before invoking ssh. Redirecting stdin isn't enough.

-- 
dwmw2




More information about the openssh-unix-dev mailing list