SSH Config - October 11, 2016

By default, SSH has a tendency to focus on usability over privacy. When connecting to an unknown server, it will iterate over all of your keys, trying each one until it gets one that works. This can cause identity leaks (see here for an example of this behavior). This ssh config prevents such leaks and allows easy adding of services without requiring a config edit each time.

To add a new service, create a new key with the filename of ~/.ssh/id_USERNAME-HOSTNAME. The config will instruct ssh to automatically use such found keys.



Host *.*
    IdentityFile ~/.ssh/id_%r-%h
    ServerAliveInterval 300
    ServerAliveCountMax 3