How do we specify an ssh default identity


id_rsa is normally a default key.

I've created a new key named 'keyhello'

I've also added this key by doing:

ssh-add /home/myuser/.ssh/keyhello

But I believe it still isn't my default key.

So, how can we put keyhello to be the default identity, instead of the id_rsa ?

I do see a -t but I've tried:

ssh-agent /home/mysuser/.ssh/keyhello -t 

No luck with this. I get a "Permission Denied" (if I put sudo ssh-agent … I got the same "Permission Denied w/out even prompt me my sudo pass).

Best Answer

In your ~/.ssh/config file put:

IdentityFile /home/myuser/.ssh/keyhello

which will tell the outgoing ssh connections to use that as the default identity

Related Question