0

I am using my Mac as the base workstation to program for a Raspberry Pi project. I use SSH as the primary tool to communicate with and work on the Pi. In the process of experimenting and trying out hardware packages I often initialize a new microSD card, so I am frequently swapping between cards from which to boot my Pi.

Problem: each card gets initialized with a different host key. So I am constantly seeing messages like the one below. Various advice I find online would suggest, just delete that host from ~/.ssh/known_hosts. But no! The message persists. Clearly, on the Mac, there is ANOTHER file of information about hosts, and it is keeping the old one around. Where is that file?

Can I just somehow suppress this entire warning system on my mac? Using SSH to an address on the local network, I don't think my exposure to hacking is too terribly great, and it would be really helpful to just be able to switch cards without a hitch.

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
WARNING: POSSIBLE DNS SPOOFING DETECTED!
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ The ECDSA host key for pi.local has changed, and the key for the corresponding IP address fe80::1e86:9970:479:7cb3%en0 is unknown. This could either mean that DNS SPOOFING is happening or the IP address for the host and its host key have changed at the same time. @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!

1 Answer 1

2

I'm not aware of any secondary known_hosts files. It is possible you have multiple entries in the known_hosts file corresponding to the same host, in which case all matching hosts would have to be deleted. It is also possible that you have multiple SSH installations from multiple sources.

In any case, to address your specific ask:

When connecting, you can specify a null known_hosts file and disable strict known_hosts checking:

ssh -o "UserKnownHostsFile=/dev/null" -o "StrictHostKeyChecking=no" [your_host_name]

This will bypass any specific host key checks, and also keep no host key history so there can't be any changes detected.

Can also do this on a per-host basis, bypassing known_hosts checks only for your local network, using ~/.ssh/config and wildcard host matching:

# whatever your local network is
Host 192.168.1.*
  UserKnownHostsFile /dev/null
  StrictHostKeyChecking no

If you have multiple SSH installations, you'd have to find the correct config file to edit first.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .