Adam Williams

So I don't have to remember this later

Twitter

Google+

Github

SSH config file

The ssh client uses the ~/.ssh/config file for configuration data. If you ssh into servers often, it’s a great place to keep options you’d otherwise add to a bash aliases or just enter each time.

Verbose example (no config):

ssh ubuntu@ec2-64-147-200-103.eu-west-1.compute.amazonaws.com -i ~/.ssh/Amazon.pem

Could be shortened to (with config):

ssh my-ec2-server

Add the following to the file ~/.ssh/config (you may need to create the file first)

Host my-ec2-server
        HostName ec2-64-147-200-103.eu-west-1.compute.amazonaws.com
        User ubuntu
        IdentityFile ~/.ssh/amazon.pem

Many more options are possible in ~/.ssh/config. See man 5 ssh_config


Sources: man 5 ssh_config, Simplify Your Life With an SSH Config File