I'm using openssh7.5p1 and gnupg 2.1.21 on arch linux (these are the default versions that come with arch). I would like to use gpg-agent
as an ssh agent. I put the following in my ~/.gnupg/gpg-agent.conf
:
pinentry-program /usr/bin/pinentry-qt
enable-ssh-support
Arch automatically starts a gpg-agent from systemd, so I set
export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/gnupg/S.gpg-agent.ssh"
When I run ssh-add -l
, it reports no identities and ps
reports a gpg-agent --supervised
process as I would expect.
Unfortunately, when I run ssh-add
, no matter what the key type, it doesn't work. Here is an example of how I tried dsa:
$ ssh-keygen -f testkey -t dsa -N ''
Generating public/private dsa key pair.
Your identification has been saved in testkey.
Your public key has been saved in testkey.pub.
$ ssh-add testkey
Could not add identity "testkey": agent refused operation
All other gpg functions work properly (encrypting/decrypting/signing). Also, the keys I generate work fine if I use them directly with ssh, and they work properly if I run the ssh-agent
that came with openssh.
The documentation says that ssh-add
should add keys to ~/.gnupg/sshcontrol
, but obviously nothing is happening.
My question: What's the easiest way to load a key generated by openssh's ssh-keygen
into gpg-agent
, and can someone please cut and paste a terminal session showing how this works?