Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 15 Jul 2011 18:58:53 -0400
From:      Jason Hellenthal <jhell@DataIX.net>
To:        Doug Barton <dougb@freebsd.org>
Cc:        FreeBSD_mailiglist_KERNEL <freebsd-stable@freebsd.org>, joerg_surmann <joerg_surmann@snafu.de>
Subject:   Re: gpg-agent dont start automatically
Message-ID:  <20110715225853.GC24288@DataIX.net>
In-Reply-To: <4E1EA170.4080708@FreeBSD.org>
References:  <4E1E8FE0.7040305@snafu.de> <4E1EA170.4080708@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help


On Thu, Jul 14, 2011 at 12:57:36AM -0700, Doug Barton wrote:
> On 07/13/2011 23:42, joerg_surmann wrote:
> > 
> > Hi all,
> > 
> > i have in my .xinitrc:
> > exec /usr/local/bin/gpg-agent --daemon --write-env-file
> > .gnupg/agent.info /usr/home/holm/.gpg-agent-info
> > 
> > Thats don't start gpg-agent.
> 
> Take a look at this:
> 
> http://dougbarton.us/PGP/gpg-agent.html
> 

This may be helpful too for reference there are a lot of ways you can go
about setting this up. Here is mine.

=======================================================================

using cron @reboot & every 5 minutes:
#!/bin/sh
# Start gpg-agent if it is not running as the current user.

umask 077

rm -f $HOME/.gpg-agent-info # only for @reboot. remove for minutely

pgrep -q -U $LOGNAME gpg-agent ||/usr/local/bin/gpg-agent --daemon
--write-env-file "${HOME}/.gpg-agent-info" >>/dev/null 2>&1

========================================================================

Then in your profile or rc file for the shell: (bourne compatible)

GPG_TTY="$(tty)"

if [ -n "$(pgrep -U $LOGNAME gpg-agent)" -a -f ${HOME}/.gpg-agent-info ]; then
	. ${HOME}/.gpg-agent-info
	export GPG_AGENT_INFO
	if [ -S ${HOME}/.gnupg/S.gpg-agent.ssh ]; then
		export SSH_AUTH_SOCK
	fi
	echo "GNU Privacy Guard Agent [ENABLED]"
	echo
else
	unset GPG_AGENT_INFO
	if [ -f ${HOME}/.gpg-agent-info ]; then
		rm -f ${HOME}/.gpg-agent-info
	fi
fi

========================================================================

Adjust appropriately for your environment.

This should allow you to use gpg-agent form the console, any xterm, rxvt
etc... and any X applications while X is running and ensure that
gpg-agent is restarted if it for some reason fails.


Good luck.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20110715225853.GC24288>