# gpgconf(1) - man - phpMan

[GPGCONF(1)](https://www.chedong.com/phpMan.php/man/GPGCONF/1/markdown)                              GNU Privacy Guard 2.2                             [GPGCONF(1)](https://www.chedong.com/phpMan.php/man/GPGCONF/1/markdown)



## NAME
       **gpgconf** - Modify .gnupg home directories

## SYNOPSIS
       **gpgconf** [_options_] **--list-components**
       **gpgconf** [_options_] **--list-options** _component_
       **gpgconf** [_options_] **--change-options** _component_



## DESCRIPTION
       The  **gpgconf**  is a utility to automatically and reasonable safely query and modify configura‐
       tion files in the ‘_.gnupg_’ home directory.  It is designed not to be invoked manually by  the
       user,  but  automatically by graphical user interfaces (GUI). ([Please note that currently no
       locking is done, so concurrent access should be avoided.  There are some precautions to avoid
       corruption  with  concurrent  usage, but results may be inconsistent and some changes may get
       lost.  The stateless design makes it difficult to provide more guarantees.])

       **gpgconf** provides access to the configuration of one or more components of the  GnuPG  system.
       These  components  correspond more or less to the programs that exist in the GnuPG framework,
       like GPG, GPGSM, DirMngr, etc.  But this is not a strict one-to-one  relationship.   Not  all
       configuration options are available through **gpgconf**.  **gpgconf** provides a generic and abstract
       method to access the most important configuration options that can feasibly be controlled via
       such a mechanism.

       **gpgconf**  can  be  used  to gather and change the options available in each component, and can
       also provide their default values.  **gpgconf** will give detailed type information that  can  be
       used to restrict the user's input without making an attempt to commit the changes.

       **gpgconf**  provides the backend of a configuration editor.  The configuration editor would usu‐
       ally be a graphical user interface program that displays the current options,  their  default
       values,  and  allows the user to make changes to the options.  These changes can then be made
       active with **gpgconf** again.  Such a program that uses **gpgconf** in this way will be  called  GUI
       throughout this section.



## COMMANDS
       One of the following commands must be given:



### --list-components
              List all components.  This is the default command used if none is specified.


### --check-programs
              List all available backend programs and test whether they are runnable.


       **--list-options** _component_
              List all options of the component _component_.


       **--change-options** _component_
              Change the options of the component _component_.


       **--check-options** _component_
              Check the options for the component _component_.


       **--apply-profile** _file_
              Apply  the  configuration settings listed in _file_ to the configuration files.  If _file_
              has no suffix and no slashes the command first tries to read a file  with  the  suffix
              **.prf**  from  the  data directory (**gpgconf** **--list-dirs** **datadir**) before it reads the file
              verbatim.  A profile is divided into sections using  the  bracketed   component  name.
              Each  section  then  lists the option which shall go into the respective configuration
              file.


### --apply-defaults
              Update all configuration files with values taken from the  global  configuration  file
              (usually ‘_/etc/gnupg/gpgconf.conf_’).


       **--list-dirs** **[**_names_]
              Lists  the  directories  used  by **gpgconf**.  One directory is listed per line, and each
              line consists of a colon-separated list where the first field names the directory type
              (for  example **sysconfdir**) and the second field contains the percent-escaped directory.
              Although they are not directories, the socket file names used by **gpg-agent** and **dirmngr**
              are  printed  as  well.  Note that the socket file names and the **homedir** lines are the
              default names and they may be overridden by command line switches.  If _names_ are given
              only the directories or file names specified by the list names are printed without any
              escaping.


       **--list-config** **[**_filename_]
              List the global configuration file in a colon separated format.  If _filename_ is given,
              check that file instead.


       **--check-config** **[**_filename_]
              Run a syntax check on the global configuration file.  If _filename_ is given, check that
              file instead.



       **--query-swdb** _package_name_ [_version_string_]
              Returns the current version for _package_name_ and if _version_string_ is  given  also  an
              indicator  on  whether an update is available.  The actual file with the software ver‐
              sion is automatically downloaded and checked by **dirmngr**.  **dirmngr** uses a thresholds to
              avoid  download  the file too often and it does this by default only if it can be done
              via Tor.  To force an update of that file this command can be used:

                gpg-connect-agent --dirmngr 'loadswdb --force' /bye



       **--reload** **[**_component_]
              Reload all or the given component. This is basically the same as sending a  SIGHUP  to
              the  component.  Components which don't support reloading are ignored.  Without _compo__‐
              _nent_ or by using "all" for _component_ all components which are daemons are reloaded.


       **--launch** **[**_component_]
              If the _component_ is not already running, start it.  **component** must be a daemon.   This
              is  in  general  not required because the system starts these daemons as needed.  How‐
              ever, external software making direct use of **gpg-agent** or **dirmngr** may use this command
              to  ensure  that  they are started.  Using "all" for _component_ launches all components
              which are daemons.


       **--kill** **[**_component_]
              Kill the given component that runs as a daemon, including **gpg-agent**, **dirmngr**, and  **sc**‐‐
              **daemon**.   A **component** which does not run as a daemon will be ignored.  Using "all" for
              _component_ kills all components running as daemons.  Note that as  of  now  reload  and
              kill have the same effect for **scdaemon**.


### --create-socketdir
              Create  a  directory for sockets below /run/user or /var/run/user.  This is command is
              only required if a non default home directory is used and the /run based sockets shall
              be used.  For the default home directory GnUPG creates a directory on the fly.


### --remove-socketdir
              Remove a directory created with command **--create-socketdir**.


## OPTIONS
       The following options may be used:



### -o
       **--output** _file_
              Write output to _file_.  Default is to write to stdout.


### -v
### --verbose
              Outputs  additional  information  while running.  Specifically, this extends numerical
              field values by human-readable descriptions.


### -q
### --quiet
              Try to be as quiet as possible.


       **--homedir** _dir_
              Set the name of the home directory to _dir_. If this option is not used, the home direc‐
              tory  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  Windows  systems)  by  means  of  the  Registry entry _HKCU\Soft__‐
              _ware\GNU\GnuPG:HomeDir_.

              On Windows systems it is possible to install GnuPG as a portable application.  In this
              case  only this command line option is considered, all other ways to set a home direc‐
              tory are ignored.

              To install GnuPG as a portable application under Windows, create an empty  file  named
              ‘_gpgconf.ctl_’  in  the  same directory as the tool ‘_gpgconf.exe_’.  The root of the in‐
              stallation is then that directory; or, if ‘_gpgconf.exe_’ has  been  installed  directly
              below  a directory named ‘_bin_’, its parent directory.  You also need to make sure that
              the following directories exist and are writable: ‘_ROOT/home_’ for the GnuPG  home  and
              ‘_ROOT/var/cache/gnupg_’ for internal cache files.


### -n
### --dry-run
              Do  not actually change anything.  This is currently only implemented for **--change-op**‐‐
              **tions** and can be used for testing purposes.


### -r
### --runtime
              Only used together with **--change-options**.  If one  of  the  modified  options  can  be
              changed  in  a  running daemon process, signal the running daemon to ask it to reparse
              its configuration file after changing.

              This means that the changes will take effect at run-time, as far as this is  possible.
              Otherwise, they will take effect at the next start of the respective backend programs.


       **--status-fd** _n_
              Write  special status strings to the file descriptor _n_.  This program returns the sta‐
              tus messages SUCCESS or FAILURE which are helpful when the caller uses a  double  fork
              approach and can't easily get the return code of the process.


## USAGE
       The  command  **--list-components** will list all components that can be configured with **gpgconf**.
       Usually, one component will correspond to one GnuPG-related program and contain  the  options
       of  that  program's  configuration file that can be modified using **gpgconf**.  However, this is
       not necessarily the case.  A component might also be a group of selected options from several
       programs, or contain entirely virtual options that have a special effect rather than changing
       exactly one option in one configuration file.

       A component is a set of configuration options that semantically  belong  together.   Further‐
       more,  several  changes  to a component can be made in an atomic way with a single operation.
       The GUI could for example provide a menu with one entry for each component, or a window  with
       one tabulator sheet per component.

       The  command  **--list-components**  lists all available components, one per line.  The format of
       each line is:

       _name_:_description_:_pgmname_:


       **name**   This field contains a name tag of the component.  The name tag is used to specify  the
              component in all communication with **gpgconf**.  The name tag is to be used _verbatim_.  It
              is thus not in any escaped format.


### description
              The _string_ in this field contains a human-readable description of the  component.   It
              can be displayed to the user of the GUI for informational purposes.  It is _percent-es__‐
              _caped_ and _localized_.


### pgmname
              The _string_ in this field contains the absolute name of the program's file.  It can  be
              used to unambiguously invoke that program.  It is _percent-escaped_.

       Example:
         $ gpgconf --list-components
         gpg:GPG for OpenPGP:/usr/local/bin/gpg2:
         gpg-agent:GPG Agent:/usr/local/bin/gpg-agent:
         scdaemon:Smartcard Daemon:/usr/local/bin/scdaemon:
         gpgsm:GPG for S/MIME:/usr/local/bin/gpgsm:
         dirmngr:Directory Manager:/usr/local/bin/dirmngr:





### Checking programs


       The  command  **--check-programs**  is similar to **--list-components** but works on backend programs
       and not on components.  It runs each program to test whether it is  installed  and  runnable.
       This also includes a syntax check of all config file options of the program.

       The  command **--check-programs** lists all available programs, one per line.  The format of each
       line is:

       _name_:_description_:_pgmname_:_avail_:_okay_:_cfgfile_:_line_:_error_:


       **name**   This field contains a name tag of the program which is identical to the  name  of  the
              component.   The  name tag is to be used _verbatim_.  It is thus not in any escaped for‐
              mat.  This field may be empty to indicate a continuation of error descriptions for the
              last name.  The description and pgmname fields are then also empty.


### description
              The  _string_  in this field contains a human-readable description of the component.  It
              can be displayed to the user of the GUI for informational purposes.  It is _percent-es__‐
              _caped_ and _localized_.


### pgmname
              The  _string_ in this field contains the absolute name of the program's file.  It can be
              used to unambiguously invoke that program.  It is _percent-escaped_.


       **avail**  The _boolean_ _value_ in this  field  indicates  whether  the  program  is  installed  and
              runnable.


       **okay**   The _boolean_ _value_ in this field indicates whether the program's config file is syntac‐
              tically okay.


### cfgfile
              If an error occurred in the configuration file (as indicated by a false value  in  the
              field  **okay**),  this  field has the name of the failing configuration file.  It is _per__‐
              _cent-escaped_.


       **line**   If an error occurred in the configuration file, this field has the line number of  the
              failing statement in the configuration file.  It is an _unsigned_ _number_.


       **error**  If  an  error occurred in the configuration file, this field has the error text of the
              failing statement in the configuration file.  It is _percent-escaped_ and _localized_.


       In the following example the **dirmngr** is not runnable and the configuration file  of  **scdaemon**
       is not okay.

         $ gpgconf --check-programs
         gpg:GPG for OpenPGP:/usr/local/bin/gpg2:1:1:
         gpg-agent:GPG Agent:/usr/local/bin/gpg-agent:1:1:
         scdaemon:Smartcard Daemon:/usr/local/bin/scdaemon:1:0:
         gpgsm:GPG for S/MIME:/usr/local/bin/gpgsm:1:1:
         dirmngr:Directory Manager:/usr/local/bin/dirmngr:0:0:


       The  command configuration file in the same manner as **--check-programs**, but only for the com‐
       ponent _component_.




### Listing options


       Every component contains one or more options.  Options may be gathered into option groups  to
       allow the GUI to give visual hints to the user about which options are related.

       The  command   lists  all options (and the groups they belong to) in the component _component_,
       one per line.  _component_ must be the string in the field _name_ in the output  of  the  **--list-**
       **components** command.

       There is one line for each option and each group.  First come all options that are not in any
       group.  Then comes a line describing a group.  Then come all options that  belong  into  each
       group.   Then  comes  the  next group and so on.  There does not need to be any group (and in
       this case the output will stop after the last non-grouped option).

       The format of each line is:

       _name_:_flags_:_level_:_description_:_type_:_alt-type_:_argname_:_default_:_argdef_:_value_


       **name**   This field contains a name tag for the group or option.  The name tag is used to spec‐
              ify the group or option in all communication with **gpgconf**.  The name tag is to be used
              _verbatim_.  It is thus not in any escaped format.


       **flags**  The flags field contains an _unsigned_ _number_.  Its value is the OR-wise combination  of
              the following flag values:


              **group** **(1)**
                     If this flag is set, this is a line describing a group and not an option.

       The  following  flag  values  are only defined for options (that is, if the **group** flag is not
       used).


              **optional** **arg** **(2)**
                     If this flag is set, the argument is optional.  This is never set  for  _type_  **0**
                     (none) options.


              **list** **(4)**
                     If this flag is set, the option can be given multiple times.


              **runtime** **(8)**
                     If this flag is set, the option can be changed at runtime.


              **default** **(16)**
                     If this flag is set, a default value is available.


              **default** **desc** **(32)**
                     If  this  flag  is set, a (runtime) default is available.  This and the **default**
                     flag are mutually exclusive.


              **no** **arg** **desc** **(64)**
                     If this flag is set, and the **optional** **arg** flag is set, then the  option  has  a
                     special meaning if no argument is given.


              **no** **change** **(128)**
                     If  this flag is set, **gpgconf** ignores requests to change the value.  GUI front‐
                     ends should grey out this option.  Note, that manual changes of the  configura‐
                     tion files are still possible.


       **level**  This field is defined for options and for groups.  It contains an _unsigned_ _number_ that
              specifies the expert level under which this group or option should be displayed.   The
              following  expert  levels  are  defined  for  options (they have analogous meaning for
              groups):


              **basic** **(0)**
                     This option should always be offered to the user.


              **advanced** **(1)**
                     This option may be offered to advanced users.


              **expert** **(2)**
                     This option should only be offered to expert users.


              **invisible** **(3)**
                     This option should normally never be displayed, not even to expert users.


              **internal** **(4)**
                     This option is for internal use only.  Ignore it.

       The level of a group will always be the lowest level of all options it contains.


### description
              This field is defined for options and groups.  The _string_ in this field contains a hu‐
              man-readable  description  of the option or group.  It can be displayed to the user of
              the GUI for informational purposes.  It is _percent-escaped_ and _localized_.


       **type**   This field is only defined for options.  It contains an _unsigned_ _number_ that specifies
              the type of the option's argument, if any.  The following types are defined:

              Basic types:


              **none** **(0)**
                     No argument allowed.


              **string** **(1)**
                     An _unformatted_ _string_.


              **int32** **(2)**
                     A _signed_ _number_.


              **uint32** **(3)**
                     An _unsigned_ _number_.

       Complex types:


              **pathname** **(32)**
                     A  _string_ that describes the pathname of a file.  The file does not necessarily
                     need to exist.


              **ldap** **server** **(33)**
                     A _string_ that describes an LDAP server in the format:

                     _hostname_:_port_:_username_:_password_:_base_dn_


              **key** **fingerprint** **(34)**
                     A _string_ with a 40 digit fingerprint specifying a certificate.


              **pub** **key** **(35)**
                     A _string_ that describes a certificate by user ID, key ID or fingerprint.


              **sec** **key** **(36)**
                     A _string_ that describes a certificate with a key by user ID, key ID or  finger‐
                     print.


              **alias** **list** **(37)**
                     A  _string_  that describes an alias list, like the one used with gpg's group op‐
                     tion.  The list consists of a key, an equal sign and space separated values.

       More types will be added in the future.  Please see the _alt-type_ field for information on how
       to cope with unknown types.


### alt-type
              This  field is identical to _type_, except that only the types **0** to **31** are allowed.  The
              GUI is expected to present the user the option in the format specified by  _type_.   But
              if the argument type _type_ is not supported by the GUI, it can still display the option
              in the more generic basic type _alt-type_.  The GUI must support all the  defined  basic
              types to be able to display all options.  More basic types may be added in future ver‐
              sions.  If the GUI encounters a basic type it doesn't support, it should report an er‐
              ror and abort the operation.


### argname
              This  field  is only defined for options with an argument type _type_ that is not **0**.  In
              this case it may contain a _percent-escaped_ and _localized_ _string_  that  gives  a  short
              name  for  the  argument.   The field may also be empty, though, in which case a short
              name is not known.


### default
              This field is defined only for options for which the **default** or **default** **desc**  flag  is
              set.  If the **default** flag is set, its format is that of an _option_ _argument_ (see: [For‐
              mat conventions], for details).  If the default value is empty,  then  no  default  is
              known.   Otherwise, the value specifies the default value for this option.  If the **de**‐‐
              **fault** **desc** flag is set, the field is either empty or contains a description of the ef‐
              fect if the option is not given.


       **argdef** This field is defined only for options for which the **optional** **arg** flag is set.  If the
              **no** **arg** **desc** flag is not set, its format is that of an _option_  _argument_  (see:  [Format
              conventions],  for details).  If the default value is empty, then no default is known.
              Otherwise, the value specifies the default argument for this option.  If  the  **no**  **arg**
              **desc** flag is set, the field is either empty or contains a description of the effect of
              this option if no argument is given.


       **value**  This field is defined only for options.  Its format is that of an _option_ _argument_.  If
              it  is  empty, then the option is not explicitly set in the current configuration, and
              the default applies (if any).  Otherwise, it contains the current value of the option.
              Note  that this field is also meaningful if the option itself does not take a real ar‐
              gument (in this case, it contains the number of times the option appears).

### Changing options


       The command to change the options of the component _component_ to the specified values.  _compo__‐
       _nent_  must  be  the  string in the field _name_ in the output of the **--list-components** command.
       You have to provide the options that shall be changed in the following format on standard in‐
       put:

       _name_:_flags_:_new-value_


       **name**   This  is  the name of the option to change.  _name_ must be the string in the field _name_
              in the output of the **--list-options** command.


       **flags**  The flags field contains an _unsigned_ _number_.  Its value is the OR-wise combination  of
              the following flag values:


              **default** **(16)**
                     If  this  flag  is set, the option is deleted and the default value is used in‐
                     stead (if applicable).


### new-value
              The new value for the option.  This field is only defined if the **default** flag  is  not
              set.  The format is that of an _option_ _argument_.  If it is empty (or the field is omit‐
              ted), the default argument is used (only allowed if the argument is optional for  this
              option).  Otherwise, the option will be set to the specified value.

       The  output of the command is the same as that of **--check-options** for the modified configura‐
       tion file.

       Examples:

       To set the force option, which is of basic type **none** **(0)**:

         $ echo 'force:0:1' | gpgconf --change-options dirmngr

       To delete the force option:

         $ echo 'force:16:' | gpgconf --change-options dirmngr

       The **--runtime** option can influence when the changes take effect.




### Listing global options


       Sometimes it is useful for applications to look at the global  options  file  ‘_gpgconf.conf_’.
       The  colon  separated  listing format is record oriented and uses the first field to identify
       the record type:


       **k**      This describes a key record to start the definition of a new ruleset for a user/group.
              The format of a key record is:

                **k:**_user_:_group_:


              **user**   This  is the user field of the key.  It is percent escaped.  See the definition
                     of the gpgconf.conf format for details.


              **group**  This is the group field of the key.  It is percent escaped.


       **r**      This describes a rule record. All rule records up to the next key  record  make  up  a
              rule set for that key.  The format of a rule record is:

                **r:::**_component_:_option_:_flag_:_value_:


              **component**
                     This is the component part of a rule.  It is a plain string.


              **option** This is the option part of a rule.  It is a plain string.


              **flag**   This  is  the flags part of a rule.  There may be only one flag per rule but by
                     using the same component and option, several flags may be assigned  to  an  op‐
                     tion.  It is a plain string.


              **value**  This is the optional value for the option.  It is a percent escaped string with
                     a single quotation mark to indicate a string.  The quotation mark is  only  re‐
                     quired to distinguish between no value specified and an empty string.


       Unknown  record  types  should  be  ignored.   Note that there is intentionally no feature to
       change the global option file through **gpgconf**.




### Get and compare software versions.


       The GnuPG Project operates a server to query the current versions of  software  packages  re‐
       lated  to  GnuPG.   **gpgconf** can be used to access this online database.  To allow for offline
       operations,  this  feature  works  by  having  **dirmngr**  download  a  file  from  **<https://ver>**‐‐
       **sions.gnupg.org**,  checking  the signature of that file and storing the file in the GnuPG home
       directory.  If **gpgconf** is used and **dirmngr** is running, it may ask  **dirmngr**  to  refresh  that
       file before itself uses the file.

       The  command **--query-swdb** returns information for the given package in a colon delimited for‐
       mat:



       **name**   This is the name of the package as requested.  Note that "gnupg"  is  a  special  name
              which  is replaced by the actual package implementing this version of GnuPG.  For this
              name it is also not required to specify a version because **gpgconf** takes its  own  ver‐
              sion in this case.


### iversion
              The  currently installed version or an empty string.  The value is taken from the com‐
              mand line argument but may be provided by gpg if not given.


       **status** The status of the software package according to this table:

              **-**      No information available.  This is either because no current version  has  been
                     specified or due to an error.

              **?**      The given name is not known in the online database.

              **u**      An update of the software is available.

              **c**      The installed version of the software is current.

              **n**      The installed version is already newer than the released version.


### urgency
              If  the  value (the empty string should be considered as zero) is greater than zero an
              important update is available.


       **error**  This returns an **gpg-error** error code to distinguish between various failure modes.


### filedate
              This gives the date of the file with  the  version  numbers  in  standard  ISO  format
              (**yyyymmddThhmmss**).   The  date has been extracted by **dirmngr** from the signature of the
              file.


### verified
              This gives the date in ISO format the file was downloaded.  This value can be used  to
              evaluate the freshness of the information.


### version
              This returns the version string for the requested software from the file.


### reldate
              This returns the release date in ISO format.


       **size**   This returns the size of the package as decimal number of bytes.


       **hash**   This returns a hexified SHA-2 hash of the package.


       More fields may be added in future to the output.



## FILES
### /etc/gnupg/gpgconf.conf
                If this file exists, it is processed as a global configuration file.
                A commented example can be found in the ‘_examples_’ directory of
                the distribution.


       _GNUPGHOME_/swdb.lst
                A file with current software versions.  **dirmngr** creates
                this file on demand from an online resource.


## SEE ALSO
       [**gpg**(1)](https://www.chedong.com/phpMan.php/man/gpg/1/markdown), [**gpgsm**(1)](https://www.chedong.com/phpMan.php/man/gpgsm/1/markdown), [**gpg-agent**(1)](https://www.chedong.com/phpMan.php/man/gpg-agent/1/markdown), [**scdaemon**(1)](https://www.chedong.com/phpMan.php/man/scdaemon/1/markdown), [**dirmngr**(1)](https://www.chedong.com/phpMan.php/man/dirmngr/1/markdown)

       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.







GnuPG 2.2.27                                 2020-12-21                                   [GPGCONF(1)](https://www.chedong.com/phpMan.php/man/GPGCONF/1/markdown)
