Last Updated: August 31, 2017
·
132
· haeck

SSH Config Setup

Anyone that uses a few SSH keys likely finds keeping track of which keys go where, a bit of a headache. Instead of keeping a cribsheet, just setup a .config file in your SSH folder and include your server details there. You can get into quite a bit of specificity with ssh_config, but duplicating the block below and swapping in your info should cover most needs.

SSH Config Block


Host SERVERNAME
User USERNAME
HostName 111.111.111.111
Port 22
PreferredAuthentications publickey
IdentityFile ~/ssh/SSHPRIVKEY

Repeat SSH Block as Needed


Copy and paste the above block, then all you need to do is ssh SERVERNAME and you're good to go. Besides keeping track of your keys, this approach also allows you to store keys in various places (including a flash drive) and you also bypass the need for recalling host & user names.