Using an OpenPGP key for SSH authentication

1 year ago
8

A walk through on how to create an OpenPGP keypair with an Authentication subkey, to allow you to login to your servers over SSH.

Add to your ~/.bashrc or ~/.zshrc file:

unset SSH_AGENT_PID
if [ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]; then
export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)"
fi

And add this to your ~/.ssh/config file:

Match host * exec "gpg-connect-agent UPDATESTARTUPTTY /bye"

Loading comments...