I cant SSH into my pi

I can use octoprint but I cannot SSH into it. it just comes up with this

What should i do because i already re put in my wifi info?

Last login: Tue Oct 23 19:43:29 on ttys000
Bens-iMac:~ Peter$ ssh pi@octopi.local
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the ECDSA key sent by the remote host is
SHA256:MaCuzmaN62KjiIvsY/Ea+qGhquJ8IuUhQE1RK0P9CDE.
Please contact your system administrator.
Add correct host key in /Users/Peter/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /Users/Peter/.ssh/known_hosts:1
ECDSA host key for octopi.local has changed and you have requested strict checking.
Host key verification failed.
Bens-iMac:~ Peter$ 

Hi,

your local machine keeps a record of "known hosts". That is to notify you things have changed. Example: You logged in from your iMac to a host called octopi.local, meanwhile it changed IP Address or you reinstalled it, By default your ssh client will give you that warning and refuse to connect. IDK about mac OS these days very much, but usually on Unix based systems (such as Mac OS) you'd have a folder called .ssh. Inside is or should be a file called known_hosts. Thats where the information in question is stored. You can try find the line of your host by IP Address or hostname and delete it IF you are sure its legit. Try again and it should ask you if you want to add the host to the "known_hosts" list and give you the login prompt after. You can also exclude this procedure entirely for your local network.

In "/etc/ssh/ssh_config" or your user config you can change that.

Host 10.*.*.*
   StrictHostKeyChecking no
   UserKnownHostsFile=/dev/null

The above will disable that issue for every host in the 10.0.0.0/8 network. You surely have a diferent network, likely 192.168.0.0 something,

Have Fun!
Jan P.

3 Likes

thanks that worked quite well

It actually indicated which line in the file as "1" as seen in the error message.

nano ~/.ssh/known_hosts
# Remove the first line, save and exit
1 Like

Please mark the solution then using the little :marksolved: button so others with the same issue may find it easier :slight_smile:

In my case, the first time i installed octoprint i did not connect the pi to a keyboard and monitor.
I could connect with ssh. When i tried to connect directly i couldn't...

Reinstalled octopi, first login with a keyboard and monitor plugged to the pi, guess what i could not connect via ssh...

Scratching my head for a while, it finally came to me:
Keyboard layout. Octipi has the UK layout by default, switching to US solved it for me.

1 Like