How a Missing SSH Config Caused Daily Two-Factor Friction With Dual YubiKeys
A developer using two enrolled YubiKeys for SSH authentication experienced a recurring daily annoyance where git push would fail on the first PIN attempt before succeeding on the second. The root cause was the absence of an SSH config file, which meant the SSH agent offered keys in arbitrary order, sometimes presenting the wrong YubiKey's credential to the server before the physically inserted token could satisfy it. Because both keys were generated with user verification required, the failed attempt triggered a visible PIN dialog rather than failing silently, making the problem noticeable roughly 15 times a day. The fix was already hinted at in the key comments, which included each YubiKey's serial number, allowing a shell script paired with OpenSSH's Match exec directive to select the correct identity file based on which token was actually plugged in. The author noted that the Match block must always include a host criterion, since omitting it would apply the restrictive IdentitiesOnly setting globally and break authentication to all other servers.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in