Posts Tagged ‘ssh’

Configuring SSH

Tuesday, February 17th, 2009

In the last while I have been having to connect to various servers using different accounts with different types of credential requirements. This has lead to some interesting ssh commands such as

ssh -l some_user -i ~/.ssh/other_key.pub example.com

After having a few servers and starting to lose the commands in my history, I figured there must be a better way to keep track of this. Turns out there is (surprise surprise). Inside your home directory, there’s a .ssh folder where you can drop a config file. So, to recreate the above example you would add the following section:

Host example.com
    User some_user
    IdentityFile ~/.sh/other_key.pub

and now I can connect with

ssh example.com

There is a whack of documentation about how this can make your life easier. Check out the man pages

man ssh_config