Force ssh to not print "Remote host identification has changed" warning

Add this to your ~/.ssh/config:

Host 10.*                            # use your own pattern here, eg. *.example.com, example.*.com
  StrictHostKeyChecking   no         # turn off the HostKey check                                                               
  LogLevel                ERROR      # keep it from printing to STDOUT
  UserKnownHostsFile      /dev/null  # (optional) add the host automatically to a black hole, otherwise it would be added to ~/.ssh/known_hosts and show you a warning/message at the top of your session. You may want it added to known_hosts if your shell uses `ssh` autocompletion, such as fish. 

You can take the line for that host out of ~/.ssh/known_host (every host has a line as entry there).

Alternative is to use:

ssh -q -o "StrictHostKeyChecking no" ....

Just using -q would have ssh silently fail.


Four ways:

To just connect once to a system with a new host key, without having to answer questions, connect with the following option:

ssh -q -o "StrictHostKeyChecking no" this.one.host.name

To permanently remove the warning for all systems, edit your ~/.ssh/config file to add the following lines:

Host *
StrictHostKeyChecking no

To permanently remove all warnings for this one server, edit your ~/.ssh/config file and add the following lines:

Host this.one.hostname
StrictHostKeyChecking no  

To remove the warning for this one change for this one server, remove the host key for that server from ~/.ssh/known_hosts. The next time you connect, the new host key will be added.

Tags:

Ssh