Skip to content

Instantly share code, notes, and snippets.

@chasgames
Last active May 17, 2025 22:33
Show Gist options
  • Save chasgames/e4baa6b6bb614f68d1dcae9836c50d0e to your computer and use it in GitHub Desktop.
Save chasgames/e4baa6b6bb614f68d1dcae9836c50d0e to your computer and use it in GitHub Desktop.
Yubikey 2024

In this example, setting up from Windows Machine, and logging in from Linux machine.

Windows:

Git Bash - RUN as admin (won't work without run as admin)

ssh-keygen -t ed25519-sk -O resident -O verify-required -O application=ssh:gserv3 -f ~/.ssh/gserv3 (optional -O user=chas -C "gserv testing")
eval $(ssh-agent -s)
ssh-add -K -S internal (on linux just ssh-add -K)
ssh-add -L (or -l verify loaded identities)
ssh-copy-id -i /mnt/c/Users/myuser/.ssh/gserv3 user@remoteserver (copy public key to server)

debug;

ssh-add -D (delete all keys if just trying the first few etc.)
ssh-keygen -K (permently download to sys)

Linux: YubiKey with PIN workaround

error: sign_and_send_pubkey: signing failed for ED25519-SK "" from agent: agent refused operation
apt-get install ssh-askpass
which ssh-askpass(optional if path different)
eval "$(ssh-agent -s; SSH_ASKPASS=/usr/bin/ssh-askpass)" (spin up ssh agent and askpass to fix asking for Yubikey PIN)

Then;

ssh-add -K
ssh-add -L
ssh user@ip

Export the public key off the yubikey to copy onto different server;\

ssh-keygen -K -f ~/.ssh/gserv3
then rinse and repeat ssh-copy-id line.

Yubikey Manager (list / delete credentials)\

./ykman.exe fido list
./ykman.exe fido delete xxxxxxx

@oidz1234
Copy link

oidz1234 commented Feb 4, 2025

needs some emoji...

@chasgames
Copy link
Author

chasgames commented May 17, 2025

./ykman.exe fido credentials list --csv

-O application=ssh:name = give Label (must be ssh:)
-C = adds comment to pub keyfile
-O verify-required = would enforce PIN / or BIO

ssh-keygen -t ed25519-sk -O resident -O application=ssh:5c -C "5c"

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