Can I pass the password from the command line?

Mario Castelán Castro marioxcc.MT at
Wed Dec 16 01:27:06 CET 2015

El 15/12/15 a las 17:21, Anthony Papillion escribió:
> Hash: SHA512
> On 12/15/2015 5:07 PM, Andrew Gallagher wrote:
>>> 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?
>> Andrew
> Thank you for the quick answer, Andrew. After thinking about it, I can
> see the absolute folly of having something set up the way I requested
> and I appreciate you pointing that out. I had not thought about piping
> to stdin - never even crossed my mind!
> Thanks again!

I recall that there is an option "--passphrase-file", which can be used 
to pass the password programatically. Of course, make sure that the file 
has secure permissions since it's created (or at least, written to) to 
store the password.

More information about the Gnupg-users mailing list