How can I delete one of my devices from the "lists of known hosts (ECDSA)" after connecting to it with SSH on Sierra ?
Or just simply using
ssh-keygen -R ip-address-or-hostname-of-your-device.
You can delete a device entry by navigating to ~/.ssh/known_hosts and remove the respective line:
In the Finder hit cmdshiftG, enter ~/.ssh/ and hit Go. Open the file known_hosts with a text editor and remove the line with your device's host name or IP-address and the ecdsa key hint (e.g. ecdsa-sha2-nistp25).
Open Terminal and enter
nano ~/.ssh/known_hosts. Move the cursor to the respective line and hit ctrlK to remove the line. To save the modified file and exit nano hit ctrlO and ctrlX
The known_hosts file looks like this:
ip-address (or host name) key_hint key
→ one line per ip-address/host!
host.example.com ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDWn... 192.168.0.7 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDEIb... 192.168.2.7 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDEIb... host3 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDWn... github.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7... host2.example.com ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHA...
Opening the file in an editor like TextEdit the lines are probably wrapped:
To remove a host (in the example github.com), choose ip (or host name), key hint and key and delete it.
Editing ~/.ssh/known_hosts removes the host for the actual user only.