1

I have created keys for git following instructions on http://help.github.com/linux-set-up-git/

This works nice, but when I try to ssh to another host, it tries to use same public key. Also, ssh to servers without public key, but password authentication fails with

$ssh user@host
Permission denied (publickey,password).

How can I solve this to use default keys for github, but not for other hosts?

I saw this but I don't want to add entry for each host, I want other to behave like I don't have any keys configured and ask for password.

2 Answers 2

1

Rename your GitHub key so that it doesn't use any of the default key files which ssh looks for (something like ~/.ssh/id_rsa_github). Then add the following to ~/.ssh/config to tell ssh to only use this key for connections to GitHub.

Host *.github.com
    IdentityFile ~/.ssh/id_rsa_github

All other connections won't attempt key authentication because there aren't default keys. However, there is usually no harm in this happening -- if the key is rejected, ssh will attempt password authentication if it is available.

0

use your .ssh/config and the IdentityFile expression:

Specifies a file from which the user's RSA or DSA authentication identity is read. The default is ~/.ssh/identity for protocol version 1, and ~/.ssh/id_rsa and ~/.ssh/id_dsa for protocol version 2. Additionally, any identities represented by the authentication agent will be used for authentication.

then refer to .ssh/id_rsa_github (or whatever the name of your 'for github only` keypair is')

1
  • Thanks. But when I use -i it does not accept passphrase, and after 3 nonsuccessive attempts I get Permission denied (publickey,keyboard-interactive).. Also, I still don't understand how to force no key to use, but use password auth?
    – umpirsky
    Mar 19, 2012 at 13:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .