Linux Blog


Section: GNU Privacy Guard (1)
Updated: 2007-12-03
Index Return to Main Contents


gpg-connect-agent - Communicate with a running agent  


gpg-connect-agent [options]



The gpg-connect-agent is a utility to communicate with a running gpg-agent. It is useful to check out the commands gpg-agent provides using the Assuan interface. It might also be useful for scripting simple applications. Inputis expected at stdin and out put gets printed to stdout.

It is very similar to running gpg-agent in server mode; but here we connect to a running instance.

The following options may be used:

Output additional information while running.

Try to be as quiet as possible.

--homedir dir
Set the name of the home directory to dir. If his option is not used, the home directory defaults to `~/.gnupg'. It is only recognized when given on the command line. It also overrides any home directory stated through the environment variable `GNUPGHOME' or (on W32 systems) by means on the Registry entry HKCU\Software\GNU\GnuPG:HomeDir.

--raw-socket name
Connect to socket name assuming this is an Assuan style server. Do not run any special initializations or environment checks. This may be used to directly connect to any Assuan style socket server.

Take the rest of the command line as a program and it's arguments and execute it as an assuan server. Here is how you would run gpgsm:
 gpg-connect-agent --exec gpgsm --server

When using -S or --exec, gpg-connect-agent connects to the assuan server in extended mode to allow descriptor passing. This option makes it use the old mode.

Print data lines in a hex format and the ASCII representation of non-control characters.

Decode data lines. That is to remove percent escapes but make sure that a new line always starts with a D and a space.



While reading Assuan commands, gpg-agent also allows a few special commands to control its operation. These control commands all start with a slash (/).

/echo args
Just print args.

/definqfile name file

Use content of file for inquiries with name. name may be an asterisk (* to match any inquiry.

/definqprog name prog
Run prog for inquiries matching name and pass the entire line to it as command line arguments

Print all definitions

Delete all definitions

/sendfd file mode
Open file in mode (which needs to be a valid fopen mode string) and send the file descriptor to the server. This is usually followed by a command like INPUT FD to set the input source for other commands.

Not yet implemented.

Same as the command line option --hex.

Same as the command line option --decode.

Print a list of available control commands.



gpg-agent(1), scdaemon(1)

The full documentation for this tool is maintained as a Texinfo manual. If GnuPG and the info program are properly installed at your site, the command

info gnupg

should give you access to the complete manual including a menu structure and an index.