SSH errors in Linux

No identities found

/usr/bin/ssh-copy-id: ERROR: No identities found

Most likely it cannot find the path to the key. Specify it explicitly with the -i flag

Example

Permissions 0644 are too open.

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ WARNING: UNPROTECTED PRIVATE KEY FILE! @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ Permissions 0644 for '/home/user/.ssh/id_rsa.pub' are too open. It is required that your private key files are NOT accessible by others. This private key will be ignored. Load key "/home/user/.ssh/id_rsa.pub": bad permissions

Most likely you are checking the wrong key.

ssh -i ~/.ssh/id_rsa.pub user@192.168.0.2

But you need

ssh -i ~/.ssh/id_rsa user@192.168.0.2

WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!

When connecting to a seemingly known host, you may get an error

ssh user@192.168.1.2

ERROR: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ERROR: @ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @ ERROR: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ERROR: IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY! ERROR: Someone could be eavesdropping on you right now (man-in-the-middle attack)! ERROR: It is also possible that a host key has just been changed. ERROR: The fingerprint for the ECDSA key sent by the remote host is ERROR: SHA256:abcde/accdefghijkld9UNaDBnnUHanJ9Svca9vFx7c. ERROR: Please contact your system administrator. ERROR: Add correct host key in /home/user/.ssh/known_hosts to get rid of this message. ERROR: Offending ECDSA key in /home/user/.ssh/known_hosts:3 ERROR: remove with: ERROR: ssh-keygen -f "/home/user/.ssh/known_hosts" -R "192.168.1.2" ERROR: ECDSA host key for 192.168.1.2 has changed and you have requested strict checking. ERROR: Host key verification failed.

From the line

ERROR: Offending ECDSA key in /home/user/.ssh/known_hosts:3

You can understand that the problem is caused by the third line of the file /home/user/.ssh/known_hosts

If you are sure that the host you are connecting to is reliable, then you can simply delete this line and connect again

sed -i 3d /home/$(whoami)/.ssh/known_hosts

ssh-keygen -R 192.168.1.2

With more complex connections, the warning may concern a specific port

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ 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 ED25519 key sent by the remote host is SHA256:nN5D5mBv00vkinsOmKbaKN1o2dEVZj5BidWaKBY1LpA. Please contact your system administrator. Add correct host key in /home/username/.ssh/known_hosts to get rid of this message. Offending ED25519 key in /home/username/.ssh/known_hosts:14 remove with: ssh-keygen -f "/home/username/.ssh/known_hosts" -R "[192.168.56.103]:1234" ED25519 host key for [192.168.56.103]:1234 has changed and you have requested strict checking. Host key verification failed.

In this case the hint is still contained in the warning (I highlighted it in green).

Run

ssh-keygen -f "/home/username/.ssh/known_hosts" -R "[192.168.56.103]:1234"

# Host [192.168.56.103]:1234 found: line 14 /home/username/.ssh/known_hosts updated. Original contents retained as /home/username/.ssh/known_hosts.old

The authenticity of host X can't be established.

If you see the following error in the connection logs

The authenticity of host '192.168.56.103 (192.168.56.103)' can't be established.

First of all, go to ~/.ssh and check whether the file exists and what it contains known_hosts as well as its permissions.

cd ~/.ssh
ls -la
vi known_hosts

Article author: Andrei Olegovich

Banner image