Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I understand that there are problems with getting pinentry-curses to work with emacs (see some of the comments on http://emacswiki.org/emacs/EasyPG), and so using emacs in a terminal isn't compatible with gpg-agent because of this.

I can't use a graphical pinentry tool in this case as this is over an ssh connection to a remote machine.

However, is it possible to feed the gpg-agent the passphrase beforehand and then have emacs use this, but not to prompt for a passphrase if the agent doesn't already have this info?

What settings would allow this to work with notmuch.el and EasyPG?

Or, are there alternative methods of caching the passphrase which would achieve the same effect, but may have security problems (which is the reason gpg-agent exists in the first place)?

share|improve this question

THIS! -> https://github.com/ecraven/pinentry-emacs

You'll have to do some wrenching, but using this thing worked for me. put the script there into a directory in your PATH and then add the following entry to ~/.gnupg/gpg-agent.conf:

pinentry-program <path-to-pinentry-emacs>/pinentry-emacs

Then reload the agent:

$ echo RELOADAGENT | gpg-connect-agent

Works like a dream for me :)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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