~/Blog

Brandon Rozek

Photo of Brandon Rozek

PhD Student @ RPI, Writer of Tidbits, and Linux Enthusiast

GPG Agent as SSH Agent

Published on

Updated on

Warning: This post has not been modified for over 2 years. For technical posts, make sure that it is still relevant.

GPG Agent has the ability to act as a SSH Agent. This allows the use of Authentication keys on Smartcards to be used with SSH as well.

First we need to enable SSH support in GPG Agent,

echo "enable-ssh-support" >> ~/.gnupg/gpg-agent.conf

Then we need to specify an environmental variable for the SSH Daemon to use GPG Agent

echo "export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket)" >> ~/.bashrc

If you want it to be active immediately, then source the bashrc,

source ~/.bashrc

If you have a smartcard plugged in, then you should be able to see it via the GPG agent

ssh-add -l

Have any questions or want to chat: Reply via Email

Enjoyed this post?

Published a response to this? :