Next: , Previous: , Up: Invoking GPG-AGENT   [Contents][Index]


2.5 Examples

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).