MacOS – Disable StrictHostKeyChecking in ssh

macosssh

I am trying to connect to a Linux host using ssh and get the following error

RSA host key for 10.1.1.20 has changed and you have requested strict checking.

I would like to override this, but can't seem to find any combination of options to do this.

I probably set StrictHostKeyChecking years ago, but don't remember how.

I consulted man ssh which informs me the system-wide configuration file is /etc/ssh/ssh_config and default for the per-user configuration file is ~/.ssh/config neither exists.

EDIT
To clarify my question, the option is clearly set. I am trying to discover

  1. Where the options are stored (I don't have the files mentioned in the
    man page, which appears to be wrong).
  2. How to change the options.

I am not looking at how to work around the issue I am having (I know I can edit the known_hosts file, but this is tedious every time I try a new server).

Best Answer

To disable strict host checking on OS X for the current user, create or edit ~/.ssh/config and add the following lines:

Host [IP Address] 
   StrictHostKeyChecking no
   UserKnownHostsFile=/dev/null

A typical example for the hosts in your local network could be:

Host 10.1.1.*
   StrictHostKeyChecking no
   UserKnownHostsFile=/dev/null

Depending on your usage of ssh I don't recommend to disable strict host key checking for all hosts.

If you just want to remove the entry for 10.1.1.20 open ~/.ssh/known_hosts with an editor of your choice and remove the respective line "10.1.1.20 ssh-rsa public-key$"