Different configurations for ssh client depending on ip address or hostname

Posted by John Smith Optional on Server Fault See other posts from Server Fault or by John Smith Optional
Published on 2013-07-01T16:46:22Z Indexed on 2013/07/01 17:08 UTC
Read the original article Hit count: 221

Filed under:
|
|
|

I have this in my ~/.ssh/config directory:

Host 12.34.56.78
    IdentityFile ~/.ssh/my_identity_file

When I ssh to 12.34.56.78, everything works fine. I'm asked for the passphrase for "my_identity_file" and I can connect to the server.

However, sometimes I'd also like to ssh to another server. But whatever the server, if I do:

ssh [email protected]

I'm also asked for the passphrase for "my_identity_file" (even though the server has a different ip address). This is very annoying because I don't have the public key for this file set up on all my servers. I'd like to connect to this other server (an old shared hosting account) with a password, and now I cant.

How do I manage to use the key authentication only with one server, and keep using password by default for servers that aren't listed in my ~/.ssh/config ?

Thanks for your help.

© Server Fault or respective owner

Related posts about ssh

Related posts about password