Use a specific SSH key with a domain

This article has been written before more than 1 years, information might old.

You are a developer but you don’t want to share your key with hosting for safety but also to enable others to easily access.

If you have different keys for every domain it’s important to say to SSH that you want a specific key.

So take a moment with this example:

We have a key named domain_dsa for domain.com but you have no idea how to add it.

Put that file where you prefer and change the file config in ~/.ssh/ adding that rule:

Host domain.com
  IdentityFile /yourpath/domain_dsa

Now SSH for that domain will use that key also if you have other dsa keys in the folder.

Pretty cool, right?

Source: https://www.cyberciti.biz/faq/force-ssh-client-to-use-given-private-key-identity-file/

Leave a Reply

Your email address will not be published. Required fields are marked *

Use a specific SSH key with a domain

time to read: <1 min
0