« Back to SSH: Frequently Asked Questions

How to disable the SSH host key check?

The ssh command can be instructed to ignore incorrect host keys with the -o StrictHostKeyChecking=no option. This sets the option StrictHostKeyChecking to ignore changed host keys.

This setting can also be configured in /etc/ssh_config to define it as its default. An alternative is to define it per host, in the file in your home directory ~/.ssh/config.

Command line usage

To use this option on the command line, specify the setting and set it to no.

ssh -o StrictHostKeyChecking=no user@hostname

Possible security impact

Disabling this check may increate the risk of a MitM attack. When possible, try to confirm why the host key changed. When using a hostname, confirm first that the name resolution is correct.

Other questions related to SSH


Is the described answer not working or incorrect, got another tip or question? Share your thoughts!