Using Yubikey for SSH on OpenSuse Tumbleweed
OpenSuse Tumbleweed comes mostly ready for use with YubiKey (Assuming you have already configured your Yubikey before).
All you need to do is a few simple configuration:
Create
.gnupgdirectory under your home directory andcdinto itmkdir ~/.gnupgp && cd $_Create
gpg-agent.confto store the requiredgpg-agentsettingsvim gpg-agent.confTell
gpg-agentwhichtty,SSH_AUTH_SOCK, and program to use to ask for PIN by adding following configuration intogpg-agent.confand saving the file:
enable-ssh-support # gpg-agent will only set the SSH_AUTH_SOCK variable if this flag is set
ttyname $GPG_TTY # Use the tty set in $GPG_TTY enviroment variable
pinentry-program /usr/bin/pinentry-curses # Use this program to ask for pin
- Tell your shell (bash, zsh etc) to set the
SSH_AUTH_SOCKandGPG_TTYforgpg-agentto use, and then launchgpg-agentif it’s not already started by adding the following your shell’s rc file (~/.bashrcfor bash,~/.zshrcfor zsh):
export GPG_TTY="$(tty)"
export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket)
gpg-connect-agent updatestartuptty /bye > /dev/null
- Open a new shell to make sure the new
rcfile is loaded, and then runssh [email protected]
If you have added your public key to your github, a prompt will pop up in shell and asks for your pin:
And upon successful login to Github, you’ll see a welcome message: