Skip to content

Instantly share code, notes, and snippets.

@lattice0
Last active October 17, 2025 22:31
Show Gist options
  • Select an option

  • Save lattice0/d80de5bebb46f6afc307c4f00ee547f0 to your computer and use it in GitHub Desktop.

Select an option

Save lattice0/d80de5bebb46f6afc307c4f00ee547f0 to your computer and use it in GitHub Desktop.
yubikey SSH simple guide for SSH resident keys
# To generate:
```
ssh-keygen -t ed25519-sk -O resident -O verify-required -C "0000000"
```
And if you move computers, in the new one just run
```
ssh-keygen -K
```
which will load the secret key ID (not the actual secret key) from the yubikey and place on the .ssh folder.
# To use:
```
sudo apt install -y gnupg2 gnupg-agent scdaemon pcscd yubikey-manager
```
```
gpg --card-status
```
Add this to your shell profile (~/.bashrc, ~/.zshrc, etc.):
```
export GPG_TTY=$(tty)
export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket)
gpgconf --launch gpg-agent
```
Then reload your shell or run:
```
source ~/.bashrc # or ~/.zshrc
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment