can't connect to `/root/.gnupg/S.gpg-agent': No such file

General support questions
Post Reply
fred_m
Posts: 5
Joined: 2014/01/24 20:55:35

can't connect to `/root/.gnupg/S.gpg-agent': No such file

Post by fred_m » 2014/01/24 21:10:14

Hi guys,

I'm using centos 6.5 and trying to create a gpg-key.
After issue the command to create my key, I received error bellow:

[frodo@seg_linux-2 ~]$ gpg --gen-key
can't connect to `/home/frodo/.gnupg/S.gpg-agent': No such file or directory
gpg-agent[16362]: command get_passphrase failed: Operation cancelled

Googling about this error I found that the gpg-agent must be started before run gpg --gen-key command and I need to add to my .bash_profile somthing like:
/usr/bin/gpg-agent --daemon --use-standard-socket

In older versions of centos I never need to start it ( I think it was made by some script or by gpg program itself)

Did you know what it happen ?

User avatar
avij
Retired Moderator
Posts: 3046
Joined: 2010/12/01 19:25:52
Location: Helsinki, Finland
Contact:

Re: can't connect to `/root/.gnupg/S.gpg-agent': No such fi

Post by avij » 2014/01/24 21:25:55

If you have a look at the manpage of gpg, you will notice gems like "gpg2 always requires the agent". So there you go, use the agent as instructed. Previous versions of gpg may have had different requirements.

rkeckler2000
Posts: 1
Joined: 2015/08/19 14:35:24

Re: can't connect to `/root/.gnupg/S.gpg-agent': No such fi

Post by rkeckler2000 » 2015/08/19 14:43:01

I have this same issue. We moved from 5.11 to 6.6 Linux.
This had us update to gnupg2

The user must export GPG_TTY
export GPG_TTY=/dev/tty (export GPG_TTY=$(tty) <- did not work for us)

The gpg-agent automatically starts when you run the gpg command.

To prevent gpg from asking for the passphrase we echo the passphrase into the command. However we still had to add in the option "--batch" to get the "--passphrase-fd 0" option to work with the pipe
echo "passphrase" | gpg --batch --passphrase-fd 0 --homedir /home/jobs/.gnupg --no-tty --output file.txt --skip-verify --decrypt encryptedfile.pgp

Post Reply