gpg-agent directories in /tmp

Martin A. Brown martin at linux-ip.net
Sat Dec 30 05:37:25 CET 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Chris,

 : I've got a bunch of directories in /tmp that are like this:
 :
 : and so on, about 25 all together. What is their purpose and can 
 : they be safely removed? What is the purpose of the S.gpg-agent 
 : socket file that is 0 bytes?

Look for other UNIX sockets on your system.  They should also have a 
filesize of 0 bytes [0].  There are probably better scripts than the 
attached for cleaning up the temporary socket files, but this will 
do the trick.  When you fire up gpg-agent, it creates a new mode 
0700 directory in which to store the socket itself.

When gpg-agent is allowed to exit gracefully, it should clean up its 
sockets (see atexit handler called cleanup in gpg-agent.c).

Best,

- -Martin

 [0] find /var /tmp -type s

- -- 
Martin A. Brown
http://linux-ip.net/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: pgf-0.72 (http://linux-ip.net/sw/pine-gpg-filter/)

iD8DBQFFle0KHEoZD1iZ+YcRAq2HAJ91H8i8C8L9Rj2ckDUpWoXn6mgT4QCgqWlk
0RklsF3nt280YdDIyUkVNko=
=Va0L
-----END PGP SIGNATURE-----
-------------- next part --------------
#! /bin/bash
#
# -- get rid of unwanted old gpg-agent directories, 2006-12-29; -MAB

DFLT_BASEDIR=/tmp
BASEDIR="$1"

# -- if the user did not specify a directory, assume that we are
#    pruning S.gpg-agent files found under /tmp
#
 : "${BASEDIR:=$DFLT_BASEDIR}"

VERBOSE=0
test -t 0 && VERBOSE="--verbose"

# -- find all "S.gpg-agent" sockets under the "$BASEDIR"
#
find 2>/dev/null "$BASEDIR" -maxdepth 2 -type s -name S.gpg-agent \
  | while read file ; do

  # -- check to see if the file/socket is in use; if not, blow away the
  #    enclosing directory
  #
  fuser "$file" >/dev/null 2>&1 \
    || rm --recursive --force $VERBOSE -- "${file%/*}"

done

# -- end of file


More information about the Gnupg-users mailing list