What you see
A window titled Connection stopped says:
This server's key differs from the one you saved. It happens after a server is reinstalled, but also when someone intercepts the connection. Accept the new key only if you know why it changed.
Below it come Saved key and Key now, with Help, Accept new key and Cancel.
After Cancel, the app shows The server's key was not accepted and the details say the server's identity was not accepted. Try Again brings the window back. In the Connection log the attempt shows as Failed, server key changed.
Why it happens
Each SSH server has a host key. The first time you connect, the app saves its fingerprint. When the server presents another key, the app stops before sending your password or key. Common reasons: the server was reinstalled, its address now points to another machine, or a load balancer sends you to different servers. It can also mean that someone is in the middle of the connection.
What to do
- Do not accept the new key straight away. Ask yourself, or the administrator, whether the server was reinstalled or moved.
- Read the fingerprints of the server from its console, not through the connection you are checking:
for f in /etc/ssh/ssh_host_*_key.pub; do ssh-keygen -lf "$f"; done - Compare the line of the same key type with Key now. If they are the same, choose Accept new key and confirm. The app forgets the old key.
- If they differ, or you cannot check, do not connect. Tell the administrator.
With OpenSSH, the same step is removing the old line from known_hosts:
ssh-keygen -R 203.0.113.10
You can also see and remove saved keys in Fingerprints. See Server fingerprints.