This way, both servers can have different hostkeys. Add something like this to your /etc/hosts: 10.52.11.171 server1Īnd then use ssh server1 when connected to subnet 1 and ssh server2 when connected to subnet2. If you switch between different private networks, you should use hostnames to connect instead, as the ssh client will also save keys depending on the hostname. If you have reinstalled the server and therefore the Identification has changed, you should just delete the specified line 155 from /Users/alexus/.ssh/known_hosts and go ahead. You could consider SSH certificate authentication to verify hosts, for example. Ssh -o StrictHostKe圜hecking=no Īs others have noted, it's probably better to address the underlying issue. Setting the StrictHostKe圜hecking=no option will allow you to connect but SSH will still show a warning: Ssh -o GlobalKnownHostsFile=/dev/null -o UserKnownHostsFile=/dev/null st To completely ignore your known hosts file in a POSIX environment, set the GlobalKnownHostsFile and UserKnownHostsFile options to /dev/null: This might be valid approach if you have a certain host which generates new host keys every time it reboots and it gets rebooted for a valid reason several times a day.
You should really check why the host key has changed.Īnother option is to add a specific entry to your ~/.ssh/config for the host in question. You can use ssh -o StrictHostKe圜hecking=no to turn off checking known_hosts momentarily.