Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

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.

share|improve this answer
add comment

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')

share|improve this answer
    
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 '12 at 13:30
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.