Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Slackware This Forum is for the discussion of Slackware Linux.


  Search this Thread
Old 10-15-2013, 04:26 PM   #1
LQ Newbie
Registered: Oct 2013
Location: Amsterdam
Distribution: Slackware
Posts: 3

Rep: Reputation: Disabled
suggestion w.r.t. pgp <--> kmail

I've found his in both Slackware-13.37 and 14.0, so please forgive if this has already been addressed in 14.1 .

I have on both mentioned Slackware versions gotten pgp-signing and encryption working, but not quite out of the box. I found that there was on both versions two missing links, that made kmail -and kleopatra for that matter- unable to connect with pgp-agent. As a result kleopatra can not add/generate/import etc.. pgp keys, and kmail cannot ask the pgp-agent to encrypt/sign/decrypt mails.

In both versions, I managed to address this by adding two simple script files to the system. The script files are run at resp start and stop of a KDE session.

The file run at KDE start: starts -if needed- the gpg-agent and sets the environment vars so other apps in the KDE session can find the agent. The actual script file can be in either ~/kde/env or /etc/kde/env . The start script file (I've used the filename contains:


## Run gpg-agent only if not already running, and available
if [ -x "${GPG_AGENT}" ] ; then

# check validity of GPG_SOCKET (in case of session crash)
if [ -f "${GPG_AGENT_INFO_FILE}" ]; then
GPG_AGENT_PID=`cat ${GPG_AGENT_INFO_FILE} | cut -f2 -d:`
GPG_PID_NAME=`ps -p ${GPG_AGENT_PID} -o comm=`
if [ ! "x${GPG_PID_NAME}" = "xgpg-agent" ]; then
rm -f "${GPG_AGENT_INFO_FILE}" 2>&1 >/dev/null
GPG_SOCKET=`cat "${GPG_AGENT_INFO_FILE}" | cut -f1 -d: | cut -f2 -d=`
if ! test -S "${GPG_SOCKET}" -a -O "${GPG_SOCKET}" ; then
rm -f "${GPG_AGENT_INFO_FILE}" 2>&1 >/dev/null

if [ -f "${GPG_AGENT_INFO_FILE}" ]; then
eval "$(cat \"${GPG_AGENT_INFO_FILE}\")"
eval "$(cut -d= -f 1 < \"${GPG_AGENT_INFO_FILE}\" | xargs echo export)"
export GPG_TTY=$(tty)
eval "$(${GPG_AGENT} -s --daemon --write-env-file ${GPG_OPTIONS})"


The file run at KDE stop: stops the gpg-agent that was started with the KDE session. Similarly, the file can be in either ~/.kde/shutdown or /etc/kde/shutdown. My file (named contains:


## The nice way
if test -n "${GPG_AGENT_INFO}"; then
GPG_AGENT_PID=`echo ${GPG_AGENT_INFO} | cut -d: -f2` && kill ${GPG_AGENT_PID} ||:

## The not so nice way
## NOTE: a root login will kill *all* users' gpg-agents
#killall gpg-agent

## clean/remove .gpg-agent-info
rm -f $HOME/.gpg-agent-info


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
gnupg pgp kmail bong.mau Linux - Security 0 05-03-2006 03:00 PM
KMail and PGP/GPG not working - doesn't ask for passphrase steve1401 Linux - General 2 02-08-2005 07:42 AM
PGP/Mime for MDK Kmail - Agypten kwalker Linux - Software 0 07-02-2004 02:53 AM
PGP & Kmail BashTin Linux - Software 9 04-09-2004 12:38 PM
KMail and PGP..... Unknown_User Linux - Software 1 02-08-2003 01:42 AM > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 09:06 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration