Batch Mode and decrypt

David Shaw dshaw at
Tue Apr 17 18:09:34 CEST 2007

On Tue, Apr 17, 2007 at 10:27:35AM -0500, jane grove wrote:
> Thanks, David.  I still have a question though:
> In my script, I used the command
> "gpg --batch --passphrase-fd 0 -d [INPUTFILE]"
> to decrypt my "INPUTFILE".  When I run the script, it pauses and wait
> for the passphrase.  If I enter the passphrase, the script goes
> through well.  If I hit enter without the right passphrase, the script
> complains about not having the right passphrase.
> How can I run this script in silent mode, feed the passphrase to it
> automatically?  I am trying not to interact with the script during its
> running.

--passphrase-fd 0 means "give me the passphrase on fd 0 (i.e. stdin)".

This is for people who have this sort of thing in their script:

 program_that_prints_the_passphrase | gpg --passphrase-fd 0

If you don't have that sort of structure, --passphrase-fd isn't useful
to you.

You sound that you want --passphrase-file or just --passphrase.

Again, though, if you're going to actually code the passphrase into
the script itself, why have a passphrase at all?


More information about the Gnupg-users mailing list