gpg-agent command examples

gpg-agent command examples

gpg-agent – Secret key management for GnuPG

The usual way to invoke gpg-agent is

$ eval $(gpg-agent --daemon)

An alternative way is by replacing ssh-agent with gpg-agent. If for example ssh-agent is started as part of the Xsession initialization, you may simply replace ssh-agent by a script like:

#!/bin/sh
exec /usr/local/bin/gpg-agent --enable-ssh-support --daemon \
--write-env-file ${HOME}/.gpg-agent-info "$@"

 

and add something like (for Bourne shells)

if [ -f "${HOME}/.gpg-agent-info" ]; then
. "${HOME}/.gpg-agent-info"
export GPG_AGENT_INFO
export SSH_AUTH_SOCK
fi

to your shell initialization file (e.g. ‘~/.bashrc’).

 

Leave a Reply

Your email address will not be published. Required fields are marked *