I have a directory with multiple .gpg files, all encrypted with the same passphrase. How can I decrypt them all without entering the passphrase over and over?


It seems like this does the trick:

gpg --decrypt-files *.gpg

In case you one day need the lines to script a solution

#!/usr/bin/env bash
_paraphrase=( "$@" )
    _pass=( "$@" )
    for _file in $(ls "${_dir}"); do
        case "${_file}" in
                echo "${_pass[*]}" | gpg --always-trust --passphrase-fd 0 --decrypt ${_file} --output ${_file%.gpg*}
    unset _pass
Decrypt "${_paraphrase[*]}"
unset _paraphrase

Similar to above works grate in my GnuPG scripts that have to decrypt without human interaction. However the accepted answer of gpg --decrypt-files *.gpg is far more secure because GnuPG is the only application handling your password.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.