2

There are several topics addressing similar issues, but none of the solutions provided there work for my environment, being:

  • macOS 11.2.3 (MacBookPro M1/Apple silicon)
  • GnuPG 2.2.27 (installed via Homebrew)
  • Zsh shell
  • GPG key with Auth-only subkey for SSH

The ~/.gnupg/gpg-agent.conf file:

pinentry-program /opt/homebrew/bin/pinentry-tty
enable-ssh-support

The ~/.gnupg/sshcontrol file:

FADD8723...AE7ED (the keygrip retrieved with `gpg -K --with-keygrip`)

The ~/.zshrc file:

unset SSH_AGENT_PID
export GPG_TTY="$(tty)"
export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket)
gpgconf --launch gpg-agent

I made sure ssh-agent is not running (also rebooted the system to be sure). But no keys are found when running:

ssh-add -L
The agent has no identities

What am i missing?

EDIT: I should add that I also configured a few Debian 10 systems like this and it works just fine.

2
  • Have you tried doing an ssh-add ~/.ssh/path-to-key?
    – bk2204
    Apr 2, 2021 at 1:20
  • No, I haven't. But I guess that would defeat the purpose of using GPG where all keys are stored centrally, protected by one passphrase. Extracting and adding each key separately is just like generating separate keys with ssh-keygen and then adding them one by one - which I used to do.
    – justClouds
    Apr 3, 2021 at 19:02

1 Answer 1

0

It looks like you're using gpg-agent for handling SSH keys instead of ssh-agent. This is fine, but because SSH keys can be installed anywhere on the system, you still have to use ssh-add to add the keys to the agent as before. At least on Linux, gpg-agent will memorize which keys you've told it about and try to load them the next time, but you still need to tell it which keys to use at first.

1
  • I expected that using GnuPG and gpg-agent would allow me to access the SSH subkey directly from the GnuPG keybox without the need to export and add it separately. None of the tutorials I found stated that particular step, and I was expecting that adding the keygrip of the SSH subkey to sshcontrol would do the trick...
    – justClouds
    Apr 4, 2021 at 10:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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