SSH Ignore (un)known host keys

Sometimes, you wish that SSH would just connect without asking questions. For instance if you are on a trusted net where you do not need to worry about man-in-the-middle attacks.

You can realise that wish with the following settings.

Onetime setting as commandline argument:

$ ssh -o UserKnownHostsFile=/dev/null 
 -o StrictHostKeyChecking=no user@192.168.0.100
Warning: Permanently added '192.168.0.100' (RSA) to the list of known hosts.
user@192.168.0.100's password:

Permanent in ssh users config ~/.ssh/config

StrictHostKeyChecking=no
UserKnownHostsFile=/dev/null

Explanation:

UserKnownHostsFile sets the location of known hosts. In this case, we use /dev/null to make sure there aren’t any existing hosts with offending host keys already present.

StrictHostKeyChecking=no means that ssh will automaticly add the key to the database (/dev/null) without asking for user confirmation.

These 2 steps together mean that ssh will totally ignore any known or unknown host key and just login without silly questions.