Different configurations for ssh client depending on ip address or hostname
- by John Smith Optional
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.