Warning Remote Host Identification Has Changed


#1

I am using two mangOH board and everytime I switch between them (one at office one at home) I run into this issue. So far the only reliable solution is to use Developer Studio to have the RSA key updated. I have tried editing the specified file to add a second RSA key so that both boards are “registered” but not much luck. Any help in resolving this issue would be great.

Thanks
Kas


#2

I just learned from a blog post I found from googling that you can do this:
ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no root@192.168.2.2

This has the effect of avoiding remote host identification for this ssh session. It’s a bad idea to do this for connections over untrusted networks because it allows for man-in-the-middle attacks.


#3

Hiya,

Or … you could remove the key each time you change boards:

ssh-keygen -f "$(HOME)/.ssh/known-hosts" -R 192.168.2.2

I’ve got this set up as a target in my makefile.

Of course, you will be prompted to accept a new device the next time connect after you remove the key

ciao, Dave


#4

Hello Dave,

Thank you for the suggestion. could you possibly share you you set this up in your makefile ?

Thanks
Kas


#5

Hiya.

Sure. I’ve added the following target to the end of my makefile:

sshclean:
     ssh-keygen -f "$(HOME)/.ssh/known_hosts" -R 192.168.2.2

NOTE: the line beginning with ssh-keygen must be indented using a TAB character (and the indent IS required and MUST be a tab character), not spaces. make requires this - and you will get some strange errors from make when parsing your makefile if you don’t use TABs to indent…

To use this, simply type

make sshclean

at the command line.

Note also that I am using a command line build using the legato tools, NOT using Dev studio - hence the makefile.

Hope this helps.

ciao, Dave