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
    HostName scotch.io
    User nick

Host example2
    HostName example.com
    User root

Host example3
    HostName 64.233.160.0
    User userxyz123
    Port 56000

Host amazon1
    HostName ec2.amazon.com
    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

image_pdfimage_print