Having multiple YubiKeys (+ fallback auth method) for ssh is annoying: I must keep pressing ESC until the right key kicks in.
This script is intended to be executed every time your hardware key is plugged in or out.
It checks current inserted hardware keys and comment/uncomment IdentityFile /path/to/id_<ID>
lines in ~/.ssh.config
.
You may follow this post to setup a Scheduled Task (two actually, one for plug, one for unplug) to invoke this script.