Debian 4.0: Installing gpg-agent
From FVue
Contents
Problem
I want to use gpg-agent on a Debian or Ubuntu console.
Environment
- Debian 4.0
- gpg-1.4.6
Solution
Install gpg-agent and pinentry program:
sudo apt-get install gnupg-agent pinentry-curses
Starting gpg-agent manually
eval $(gpg-agent --daemon)
Starting gpg-agent automatically from console machine
Shell agnostic
Add the lines below to ~/.profile. Any POSIX-confirming shell should include this file.
# Invoke GnuPG-Agent the first time we login. # Does `~/.gpg-agent-info' exist and points to gpg-agent process accepting signals? if test -f $HOME/.gpg-agent-info && \ kill -0 `cut -d: -f 2 $HOME/.gpg-agent-info` 2>/dev/null; then GPG_AGENT_INFO=`cat $HOME/.gpg-agent-info | cut -c 16-` else # No, gpg-agent not available; start gpg-agent eval `gpg-agent --daemon --no-grab --write-env-file $HOME/.gpg-agent-info` fi export GPG_TTY=`tty` export GPG_AGENT_INFO
Bash specific
Add the following lines to .bash_profile or .bash_login:
# Invoke GnuPG-Agent the first time we login. # Does `.gpg-agent-info' exist and points to a gpg-agent process accepting signals? if [ -f $HOME/.gpg-agent-info ] && \ kill -0 $(cut -d: -f 2 $HOME/.gpg-agent-info) 2>/dev/null then # Yes, `.gpg-agent.info' points to valid gpg-agent process; # Indicate gpg-agent process GPG_AGENT_INFO=$(cat $HOME/.gpg-agent-info | cut -c 16-) else # No, no valid gpg-agent process available; # Start gpg-agent eval $(gpg-agent --daemon --no-grab --write-env-file $HOME/.gpg-agent-info) fi export GPG_TTY=$(tty) export GPG_AGENT_INFO
See also
- Using gnupg-agent to securely retain keys - Debian Administration
- Concise article describing how to use gpg-agent
- info gpg-agent
- Typing info gpg-agent from a console gives you the manual
Journal
20080401
$ eval $(gpg-agent) # Wrong syntax gpg-agent[24981]: directory `/home/myname/.gnupg/private-keys-v1.d' created gpg-agent[24981]: can't connect to `/home/myname/.gnupg/S.gpg-agent': No such file or directory gpg-agent: no gpg-agent running in this session $ eval $(gpg-agent --daemon) # Right syntax $
I receive this error when using gpg:
gpg: problem with the agent - disabling agent use
It appeared a pinentry program was missing. I was able to solve the error message by installing a console pinentry program:
$ sudo apt-get install pinentry-curses
You can select your preferable pinentry program by issuing:
$ sudo apt-cache search pinentry
20080921
- http://thefunkcorner.blogspot.com/2008/06/using-gnupg-agent-on-console.html
- More information to auto-start gpg-agent on the console:
Advertisement