Can I pass the password from the command line?

Steve Butler sbutler at
Wed Dec 16 00:21:13 CET 2015

There is under 1.4.  Don't know if it is in v2.  I'm not at my desk to pop the script open.   But you could pipe the passphrase via stain and tell gpg  to grab it from there.  Be careful as that still leaves it in the clear to those reading your script.   Potential local users could also see it if you echo'd it to the pipe.

Sent from my Verizon Wireless 4G LTE smartphone

-------- Original message --------
From: Andrew Gallagher <andrewg at>
Date: 12/15/2015 15:09 (GMT-08:00)
To: Anthony Papillion <anthony at>
Cc: gnupg-users at
Subject: Re: Can I pass the password from the command line?

> On 15 Dec 2015, at 22:58, Anthony Papillion <anthony at> wrote:
> I'd like to script encryption and decryption from the command line. Is
> there a way to pass the encryption passphrase to GnuPG from the
> command line.

I don't think there is a password parameter, and I'd strongly recommend not doing it even if there was. Many OSes make the command line parameters of processes available to any local user.

Have you tried piping the password to stdin?

Gnupg-users mailing list
Gnupg-users at

CONFIDENTIALITY NOTICE: This e-mail message, including any attachments, 
is for the sole use of the intended recipient(s) and may contain 
and privileged information. Any unauthorized review, use, disclosure or 
distribution is prohibited. If you are not the intended recipient, please 
contact the sender by reply e-mail and destroy all copies of the original 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/attachments/20151215/251bd315/attachment-0001.html>

More information about the Gnupg-users mailing list