Circumventing "Remote Host Identification Has Changed" warning

Solution 1:

Another solution to prevent the host key from being saved in the first place

Please note that this will disable part of what makes ssh secure, the verification that the host you are connecting to is in fact the host you think it is!

Add a section to ~/.ssh/config

host 192.168.*.*
    StrictHostkeyChecking no
    UserKnownHostsFile /dev/null

Solution 2:

If you want to pass arguments to a something pre-defined in Bash, you could use a function instead of an alias to the same effect:

ssh-keyrm() { ssh-keygen -f "$HOME/.ssh/known_hosts" -R "$1"; }

Which would be run as such:

$ ssh-keyrm 127.0.0.1

Like aliases, functions can be stored in .bashrc, .bash_profile, or defined inlne in a shell.