SSH quickly with SSH aliases

Speed up access via SSH by making aliases. This means that typing something like:

ssh -i '~/.ssh/your-private-key'

Can be replaced with something simple to remember and type like:

ssh myserver

To do this…..

1. Navigate to ~/.ssh . and create a config file.

cd ~/.ssh
touch config

2. Open the file in nano and for each server alias required, add a block like below.

# Example
Host example
HostName example
User user1
IdentityFile ~/.ssh/example-key

3. Then so long as the key exists and has suitable permissions, ssh to your server as simple as:

ssh example

This saves a lot of time when dipping in and out of multiple machines on a daily basis. If there is a permission warning shown the keys permission can be updated:

chmod 600 ~/.ssh/example-key