Reputation: 23
Well, I have seen answers in the ssh post of having multiple private key, but I haven't gain enough reputations to add any comment so I have to write a new question (sorry about that).
In the post, the answer given is the config file to direct(point to) each host/username to the private key file that it suppose to use but is there any way to have a default private key file for general use, then some others private key file for some specific use?
For example, I use my school gitlab repository so I use one specific private key for it, then I have accounts on gitlab, github .... and others ssh connections that use the same private key (but different from the school one, of course).
So, is there a way to config a default private key so should it failed to use the specific key it will use the default or I have to configure everything manually?
Upvotes: 2
Views: 499
Reputation: 1323553
is there any way to have a default private key file for general use, then some others private key file for some specific use?
You define in your ~/.ssh/config file an entry Host *
Host h1
...
Host *
IdentityFile /my/default/ssh/key
Make sure to define it last (or you would need to add exclusion patterns).
Upvotes: 1