Skip to content

Instantly share code, notes, and snippets.

@psolru
Last active January 24, 2023 20:27
Show Gist options
  • Save psolru/f730f9ccbfdc35a12471dc1e82a3f48d to your computer and use it in GitHub Desktop.
Save psolru/f730f9ccbfdc35a12471dc1e82a3f48d to your computer and use it in GitHub Desktop.
Setup Yubikey

Setup for SSH

  • Plug in the Yubikey 5 Nano and fire up the terminal.

gpg2 --edit-card
admin
key-attr

  • each "RSA" and "4096"

generate Make off-card backup of encryption key? n

  • Type in the USER default PIN: 123456
  • Type in your stuff

Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? O

  • Now it will generate some Keys. This will take some time.

  • Set our new SSH Socket (put this into your .bashrc or whatever)

export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket)
gpgconf --launch gpg-agent

  • Then we're able to get the public key:

ssh-add -L

  • gpg2 --change-pin

Troubleshooting

  • If gpg2 throws 'gpg: selecting card failed: No such device', do this and try again:

echo 'reader-port Yubico Yubi' >> scdaemon.conf

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