I've been trying to get a yubikey to work as an authentication method for remote connections via ssh using this guide. I got the gpg2 set up nicely, and I can see that i've loaded the key onto the card by

gpg2 --card-status

I've exported it using

gpg2 --export-ssh-key > [keyname].txt

and can see the resulting key nicely. I've got my gpg-agent.conf set up as follows :

#config pinentry-program
pinentry-program /usr/bin/pinentry

#ssh support

#write env inf to .gpg-agent-info

#default cache timeout
default-cache-ttl 600
max-cache-ttl 7200

and have modified my .bashrc as given in the guide. Any ideas where I might look for a solution?

  • Isn't it more important to test the connection - does it connect? The troubleshooting section suggest to kill the ssh-agent and start the gpg-agent and create a .plist file. – Michael D. Feb 9 '17 at 11:20
  • @MichaelD. not sure I'm following you - I'm pretty new to linux platforms and I'm going through a lot of new information. What do you mean by test the connection? Connection between what exactly? If it's ssh to the other machine, that works fine. I tried killing the ssh-agent but I'm pretty unsure on how to proceed. – user215112 Feb 9 '17 at 12:36
  • Okay - I got it working. The problem was probably the SSH_AUTH_SOCK not pointing to my gpg-agent.ssh , which I resolved by forcing the address in .bashrc. – user215112 Feb 9 '17 at 13:28

Okay, so I got it working after tinkering for a while and reading the gpg-agent manpage here. I needed to add

     if [ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]; then
       export SSH_AUTH_SOCK="${HOME}/.gnupg/S.gpg-agent.ssh"

to my .bashrc for the SSH_AUTH_SOCK to point to the correct place instead of the ssh-agent.

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.