Some changes in the GnuPG configuration demand a gpg-agent restart / reboot, but... How can I do that? I tried gpg-agent restart, service gpg-agent restart, but did not succeed.


With current GPG (2.1+), to stop gpg-agent you can use gpgconf --kill, like this:

gpgconf --kill gpg-agent

You shouldn’t need to manually restart it. GPG will restart it when it’s needed.

  • 3
    There are cases where you want to start the agent manually, e.g. when you use it with ssh support enabled. The agent will NOT automatically start when you attempt an ssh login. – hasufell Dec 17 '17 at 22:36
  • If you ever delete the ~/.gnupg directory, you will need to restart the gpg agent manually. – Christopher Martin Feb 24 '18 at 21:16

My preferred way is with gpg-connect-agent reloadagent /bye. See gpg-connect-agent help /bye for a complete list of commands.


gpg-agent is not a system-wide service but started once per user (thus, it is not managed by service). Although sometimes invoked by user's dotfiles or at least in Debian and derivatives also when X11 is started (and gpg-agent is installed) in /etc/X11/Xsession.d/90gpg-agent (to make sure a common gpg-agent is used by all GnuPG calls, no matter whether from a terminal or GUI applications); it is also started automatically by GnuPG when required. From man gpg-agent:

The agent is automatically started on demand by gpg, gpgsm, gpgconf, or gpg-connect- agent. Thus there is no reason to start it manually. In case you want to use the included Secure Shell Agent you may start the agent using:

gpg-connect-agent /bye

Usually, a simple killall gpg-agent (from a non-root shell) should be fine for terminating gpg-agent. You'll likely observe a slight delay when using GnuPG the next time, as gpg-agent is started again.

  • 2
    This changes in GPG 2.1.x and the process is handled through dirmngr. The commands to run then are dirmngr --shutdown followed by dirmngr --daemon and sometimes additional options (I also include a specific GPG homedir and the --use-tor flag). – Ben May 22 '16 at 4:45

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.