Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Hello, world!,

I have a VPS set up with multiple domain names pointing to it. Arbitrarily, I like to access it via SSH through the domain name I'm dealing with. So for example, if I'm doing something with, I'll log in with ssh, and if I'm working with, I'll log in with ssh They both point to the same user on the same machine. However, because SSH keeps track of the server's fingerprint, it tells me that there is an offending host key, and makes me confirm access.

$ ssh
Warning: the ECDSA host key for '' differs from the key for
the IP address ''
Offending key for IP in /home/me/.ssh/known_hosts:33 
Matching host key in /home/me/.ssh/known_hosts:38
Are you sure you want to continue
connecting (yes/no)?

Is there a way to ignore this warning? Thanks!

share|improve this question
up vote 3 down vote accepted

Add this to your .ssh/config file:

   StrictHostKeyChecking no

This will disable the host key checking and the warnings, but only for that IP. It will also save the host key for that machine in /dev/null thus avoiding future mismatches.

Host example*.com
  StrictHostKeyChecking no

EDIT: My first answer wasn't exactly correct for your this case. These settings will take effect the next time you ssh into a matching hostname. The asterisk acts as a wildcard, so it will match, and so on.

share|improve this answer
Do I need to logout/login for it to take affect? Or delete those lines from the known_hosts file? – Jonah Aug 30 '12 at 19:19
You'll have to add one entry (Host + StrictHostKeyChecking + UserKnownHostsFile) for every domain. If you're only going to connect to the VPS or if you don't care too much about security, you could have a .ssh/config file with just two lines and nothing else: StrictHostKeyChecking no and UserKnownHostsFile=/dev/null. – r.t. Aug 30 '12 at 21:18
Cool, it works great, thanks. – Jonah Aug 30 '12 at 22:26

Your Answer


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.