gpg commands in RHEL 6 work fine, but print error: can't connect to `/home/user/.gnupg/S.gpg-agent': No such file or directory

Solution Verified - Updated -

Issue

  • Most gpg encryption/decryption and sign/verify commands in RHEL 6 are printing the can't connect to '/home/user/.gnupg/S.gpg-agent' error, even when the operation seems to succeed
    Is this error a problem?
    Example 1:

    [root ~]# gpg --symmetric -o out.gpg --batch --passphrase 'mYp@55w0rd' /etc/redhat-release
    can't connect to `/root/.gnupg/S.gpg-agent': No such file or directory
    [root ~]# gpg --decrypt --batch --passphrase 'mYp@55w0rd' out.gpg
    gpg: 3DES encrypted data
    gpg: encrypted with 1 passphrase
    Red Hat Enterprise Linux Server release 6.6 (Santiago)
    gpg: WARNING: message was not integrity protected
    

    Example 2:

    [root ~]# gpg --sign -o out.gpg /etc/redhat-release
    
    You need a passphrase to unlock the secret key for
    user: "Moo Cow <moocow@devnull>"
    1024-bit RSA key, ID 43D67E41, created 2015-07-22
    
    can't connect to `/root/.gnupg/S.gpg-agent': No such file or directory
    
    ┌───────────────────────────────────────────────────────────────┐
    │ Please enter the passphrase to unlock the secret key for the  │
    │ OpenPGP certificate:                                          │
    │ "Moo Cow <moocow@devnull>"                                    │
    │ 1024-bit RSA key, ID 43D67E41,                                │
    │ created 2015-07-22.                                           │
    │                                                               │
    │ Passphrase **********________________________________________ │
    │                                                               │
    │         <OK>                                   <Cancel>       │
    └───────────────────────────────────────────────────────────────┘
    
    [root ~]# ll out.gpg
    -rw-r--r--. 1 root root 248 Jul 23 16:15 out.gpg
    [root ~]# gpg --verify out.gpg
    gpg: Signature made Thu 23 Jul 2015 04:15:29 PM EDT using RSA key ID 43D67E41
    gpg: Good signature from "Moo Cow <moocow@devnull>"
    

Environment

  • Red Hat Enterprise Linux 6
  • gnupg2-2.0.14*

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In