Disable StrictHostKeyChecking in ssh
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
- Where the options are stored (I don't have the files mentioned in the man page, which appears to be wrong).
- 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).
Solution 1:
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$"
Solution 2:
You can simply try it as it is without confitguration, just on commandline:
ssh -o StrictHostKeyChecking=no hostname
But I don't think it does all you need. If you want to ignore all hostkey checking, you need to set up you known_hosts
file to /dev/null
so there will never be anything stored:
ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null hostname
or in /etc/ssh_config
:
StrictHostKeyChecking no
UserKnownHostsFile /dev/null