I use a dotfiles repo to maintain my Linux profile settings across multiple machines (e.g.
.gitconfig). Every so often, I manage to break one of my remote hosts’ SSH agent for passwordless authentication (after I unlock the PGP keys locally with a password on boot) – and all of a sudden I can’t run my deployment and git scripts on the remote host. (Because they can’t do keypair authorization with github.com et al).
So… I sought to add a brief message about whether SSH agent was running (and which key it had loaded). I routinely edit my
.localrc to print pertinent server information upon remoting into a Linux server, but as it would be duplicative to add such info about my SSH agent to all servers’
.localrc I packed it into my dotfiles repo. And then I separated it out as an
inforc file to keep my repo neat and clean.
The following code should print the loaded SSH key’s fingerprint when you log in to a remote host (or a warning if there is no key in SSH agent!). I also included a message which prints the most recent dotfiles commit since some hosts’ repo folders stagnate and fall behind the
master branch tip.
1 2 3 4
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25