Bypass known_hosts file for Vagrant boxes

Problem

As Vagrant boxes are created & destroyed, the entries in ~/.ssh/known_hosts become obsolete, and SSH throws warnings or fails with vagrant ssh, drush operations, etc.

Solution

Add these lines to ~/.ssh/config

######################################################
# Vagrant
######################################################

Host 192.168.*.*
    StrictHostKeyChecking no
    UserKnownHostsFile /dev/null

Host local.*.*
    StrictHostKeyChecking no
    UserKnownHostsFile /dev/null

Host *.loc
    StrictHostKeyChecking no
    UserKnownHostsFile /dev/null

 

Add new comment