Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save drocamor/878731 to your computer and use it in GitHub Desktop.
Save drocamor/878731 to your computer and use it in GitHub Desktop.
Exporting the public part of your PGP authentication subkey
# I took this from here: http://www.programmierecke.net/howto/gpg-ssh.html
# Deactivate the gnome-keyring. We will be replacing it with gnupg-agent
gconftool-2 --type bool --set /apps/gnome-keyring/daemon-components/ssh false
# Configure gpg to use the agent
echo "use-agent" >> ~/.gnupg/gpg.conf
# Enable ssh-agent drop in replacement support for gpg-agent
echo "enable-ssh-support" >> ~/.gnupg/gpg-agent.conf
# Find the fingerprint of your authentication subkey.
gpg --list-keys '[email protected]'
# You should see something like:
# pub 4096R/01A35709 2010-01-30 [expires: 2011-06-12]
# uid J. Alfred Prufrock <[email protected]>
# sub 2048R/B283E368 2010-01-30
# That sub is the authentication subkey. Convert it to the SSH format like so:
gpgkey2ssh B283E368 >> ~/my-public-key
# Now use my-public-key as your authorized_keys file on remote servers
# gpgkey2ssh is from the gnupg-agent package yet it has no manpage, no usage, no --help, and is basically undocumented. Awesome, right?
@edeca
Copy link

edeca commented Jun 25, 2016

Newer versions of gpg have the --export-ssh-key option.

See this post on the mailing list: https://lists.gnupg.org/pipermail/gnupg-devel/2016-January/030682.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment