automating ssh-keygen

Darren Tucker dtucker at
Tue Apr 18 10:27:57 EST 2006

Doug Lochart wrote:
> I am trying to automate ssh-keygen creating keys without a passphrase.
> How can I run a script that calls ssh-keygen so that it does NOT
> require a passphrase?  When I was testing on the command line I
> created a file that contained 2 line feeds and piped it into stdin.  I
> got a message mentioning that ssh-askpass could not be found and it
> completed.

That didn't work because ssh-keygen reads its passphrases from its 
controlling terminal (or ssh-askpass) not stdin.

> I did not try the keys but I would like to be able to
> generate them without any error messages.  Is this possible?

$ ssh-keygen -N '' -f foo

Darren Tucker (dtucker at
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