ssh aliases

cd ~/.ssh

Following this, you’ll need to create a file called config. Here’s how to do it with Vim:

mcedit config

From here, you can now create shortcuts. You can specify the hostname, username, port, and the private key. For a full list of options, please visit the official docs. Here’s an example of how to structure the file:

Host scotch
    User nick

Host example2
    User root

Host example3
    User userxyz123
    Port 56000

Host amazon1
    User ec2-user
    IdentityFile /path/to/special/privatekey/amazon.pem

Now, you can simply SSH into any of these servers with these simple commands:

ssh scotch
ssh example2
ssh example3
ssh amazon1

If this isn’t working for you, trying changing the permissions of the config file like this:

chmod 600 ~/.ssh/config