WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED

For all those command line ssh users out there who have encountered WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED when they know they are connecting to the correct device/server, here is a way to prevent this error from appearing so you can get your work done quickly.

First, there are options in ssh to ignore host key checking to suppress this warning. You can do use the following options when making starting an ssh session.

ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no [user]@[ipAddress]

However, that is a bit cumbersome to type every time when we are all used to just typing

ssh [user]@[ipAddress]

So to ease the pain, you can add a new command via .bashrc to do this automatically. In Ubuntu, you can edit your /home/[user]/.bashrc and add

sshignore() {
ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no $1
}
alias sshi=sshignore

After you save the changes to .bashrc, reload it by doing

source /home/[user]/.bashrc

Now you can just do the following when starting an ssh session and suppress the warning.

sshi [user]@[ipAddress]

NOTE: Obviously, ssh defaults to showing you this warning for security reasons and you should know why are want to circumvent the warning. So only use it in situations such as reconfiguring ipAddresses for many devices over and over again where the warnings are just annoying.