Add gpg-agent link in gpg-agent post.
[blog.git] / posts / gpg-agent.mdwn
1 The 2.X branch of [[GnuPG]] comes with [gpg-agent][] for caching
2 passphrases.  The documentation is good, but here are my notes
3 outlining my usual usage.
4
5 Add
6
7     if [ -f "${HOME}/.gnupg/agent-info" ]; then
8       source "${HOME}/.gnupg/agent-info"
9     fi
10
11 Start the agent with
12
13     $ GPG_TTY=$(tty)
14     $ gpg-agent --daemon --write-env-file "${HOME}/.gnupg/agent-info"
15     $ echo "GPG_TTY='${GPG_TTY}'; export GPG_TTY" >> "${HOME}/.gnupg/agent-info"
16     $ source "${HOME}/.gnupg/agent-info"
17
18 The `GPG_TTY` bit will spawn the `pinentry` call in the designated
19 TTY.  This avoids troublesome issues like pinentry clobbering [[Mutt]]
20 if they are both using ncurses.
21
22 When you are done with the agent, kill it with
23
24     $ killall gpg-agent
25     $ rm -f "${HOME}/.gnupg/agent-info"
26
27 [gpg-agent]: http://www.gnupg.org/documentation/manuals/gnupg/Invoking-GPG_002dAGENT.html
28
29 [[!tag tags/linux]]
30 [[!tag tags/tools]]