mute output of gpg2 -d

J. Tull heavytull at hotmail.com
Fri Jul 13 20:27:38 CEST 2018


On +0200, john doe wrote:
> On 7/13/2018 11:13 AM, J. Tull wrote:
> > It seems the usual way to supress the output of a command in linux is not
> > working for gpg2:
> > 
> >      $gpg2 -d my_file.gpg 2>/dev/null
> > 
> > still outputs some data through stderr. So could someone try to find out a
> > way to get rid of everything gpg2 is outputting but the decrypted output of
> > the gpg file?
> > 
> 
> It is working fine here, which version of gpg2 do you have and which distro
> are you using?
> 
> Output redirection is more  a shell issue then a gpg2 problem.
> Can you redirect STDERR of other commands to the null device?
> 
> -- 
> John Doe

of course i can redirect STDERR to /dev/null. i retried with "find /root" as
a normal user and it worked. I use it daily to run irssi through proxyserve.

$ gpg2 --version
gpg (GnuPG) 2.0.31
libgcrypt 1.7.10
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Home: ~/.gnupg
Supported algorithms:
Pubkey: RSA, RSA, RSA, ELG, DSA
Cipher: IDEA, 3DES, CAST5, BLOWFISH, AES, AES192, AES256, TWOFISH,
        CAMELLIA128, CAMELLIA192, CAMELLIA256
Hash: MD5, SHA1, RIPEMD160, SHA256, SHA384, SHA512, SHA224
Compression: Uncompressed, ZIP, ZLIB, BZIP2


On -0500, gpgff00 at lacutt.com wrote:
> On Fri, Jul 13, 2018 at 09:13:06AM +0000, J. Tull wrote:
> > It seems the usual way to supress the output of a command in linux is not
> > working for gpg2:
> > 
> >     $gpg2 -d my_file.gpg 2>/dev/null
> 
> Have you tried "gpg -qd my_file.gpg" ?

below is a copy of some tests. Running normally, then with STDERR redirected
to the null device, and then with -q option. Only redirecting STDOUT to the
null device works normally, i.e. the decrypted output is not displayed.

[user at linuxbox ~]$ gpg2 -d my_file.gpg 

You need a passphrase to unlock the secret key for
user: "user <user at linuxbox.com>"
2048-bit ELG key, ID xxxxxxxxxxx, created 2018-07-13 (main key ID XxXxXxXxXxXxX)

gpg: encrypted with 2048-bit ELG key, ID xxxxxxxxxxx, created 2018-07-13
      "user <user at linuxbox.com>"

""" decrypted content of file """



[user at linuxbox ~]$ gpg2 -d .my_pwds.gpg 2>/dev/null

You need a passphrase to unlock the secret key for
user: "user <user at linuxbox.com>"
2048-bit ELG key, ID xxxxxxxxxxx, created 2018-07-13 (main key ID XxXxXxXxXxXxX)

""" decrypted content of file """



[user at linuxbox ~]$ gpg2 -qd .my_pwds.gpg            

You need a passphrase to unlock the secret key for
user: "user <user at linuxbox.com>"
2048-bit ELG key, ID xxxxxxxxxxx, created 2018-07-13 (main key ID XxXxXxXxXxXxX)

""" decrypted content of file """





More information about the Gnupg-users mailing list