One of the more annoying things I deal with on a daily basis is having multiple laptops. I spend a lot of time sshing to servers I own, or even more commonly git clone and git pushing stuff. Naturally, I use SSH for that as well.

I own a YubiKey4 and it’s simple enough, with decent instructions for how do normal SSH Auth with it. Howerver, to my fellow devs looking, one thing it slightly misses it making sure SSH will use the YubiKey as a default smartcard/auth method.

For OS X, I had to do

$ brew install OpenSC

In your ~/.ssh/config simply adding

Host *
	SmartcardDevice /usr/local/Cellar/opensc/0.15.0/lib/pkcs11/opensc-pkcs11.so

For Linux (ubuntu 16)

$ apt-get install opensc-pkcs11

And my resulting ~/.ssh/config

Host *
	SmartCardDevice /usr/lib/x86_64-linux-gnu/opensc-pkcs11.so

Hope this helps you reach your state of SSH nirvana!

Your paths will almost surely vary, ensure those are set for your particular computer :)

–breland