key generation in a script or non interactive mode?

Afzal, Naeem M naeem.m.afzal at
Thu Jul 10 20:04:39 CEST 2008

Thanks, that was exactly what I was looking for. I followed the instructions in the doc, and it works on Ubuntu host as user, but if I chroot to a filesystem within this host, I get the following error within chroot'd filesystem:

user at ubuntu-host$ sudo chroot ~/target/fs

root at ubuntu-host# cat >foo <<EOF
     %echo Generating a standard key
     Key-Type: DSA
     Key-Length: 1024
     Subkey-Type: ELG-E
     Subkey-Length: 1024
     Name-Real: Joe Tester
     Name-Comment: with stupid passphrase
     Name-Email: joe at
     Expire-Date: 0
     Passphrase: abc
     %secring foo.sec
     # Do a commit here, so that we can later print "done" :-)
     %echo done
root at ubuntu-host# gpg --batch --gen-key -a foo
/usr/bin/gpg: 1: Syntax error: "(" unexpected

>Please read the section "Unattended key generation" in doc/DETAILS.

More information about the Gnupg-users mailing list