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 ctrl K to remove the line.
These hosts keys are stored at locations '/etc/ssh/known_hosts' and '. ssh/known_hosts' in each user's home directory.
You can remove the warning brutally by just editing the file ~/. ssh/known_hosts and remove all lines whose key is the same as that associated with the IP address. For example, if you have "Warning: Permanently added the RSA host key for IP address '140.82.
Solution: create a ~/.ssh/config
file and insert the line:
UserKnownHostsFile ~/.ssh/known_hosts
You will then see the message the next time you access Github, but after that you'll not see it anymore because the host is added to the known_hosts
file. This fixes the issue, rather than just hiding the log message.
This problem was bugging me for quite some time. The problem occurs because the OpenSSH client compiled for Windows doesn't check the known_hosts file in ~/.ssh/known_hosts
ssh -vvvvvvvvvvvvvvvvvvv [email protected]
debug3: check_host_in_hostfile: filename /dev/null
debug3: check_host_in_hostfile: filename /etc/ssh/ssh_known_hosts
debug3: check_host_in_hostfile: filename /dev/null
debug3: check_host_in_hostfile: filename /etc/ssh/ssh_known_hosts
Warning: Permanently added 'github.com,207.97.227.239' (RSA) to the list of known hosts.
Add the following line to your ssh config file ($HOME/.ssh/config):
LogLevel=quiet
If running ssh from the command line add the following option to the command string:
-o LogLevel=quiet
For example, the following prints out the gcc version installed on machine.example.org (and no warning):
ssh -o UserKnownHostsFile=/dev/null \
-o StrictHostKeyChecking=no \
-o LogLevel=quiet \
-i identity_file \
machine.example.org \
gcc -dumpversion
Set LogLevel
to ERROR
(not QUIET
) in ~/.ssh/config
file to avoid seeing these errors:
Host *
StrictHostKeyChecking no
UserKnownHostsFile /dev/null
LogLevel ERROR
That message is from SSH, which is warning you that you are connecting to a host which you've never connected to before. I wouldn't recommend turning it off, since it would mean that you might miss a warning about a host key changing, which can indicate a MITM attack on your SSH session.
To suppress warning messages for ssh
you can add the following lines to ~/.ssh/config
:
Host *
LogLevel error
That will disable warnings but not error messages. Like the other settings in ~/.ssh/config
you can configure the LogLevel
on a per-host basis if you want a more finegrained control.
It mainly means there are changes for the key for that host ~/.ssh/known_hosts
, and it will not automatically UPDATE it. Therefore every time you get this warning message.
This happens often for the connecting to the re-created virtual machines, which changes the key with the same IP address
Solution
If you only have one entry, then you can delete the ~/.ssh/known_hosts
file, and after first connection, that the key will be there, and no warning messages after that.
If you have multiple entries, then you can use command below to remove
$ ssh-keygen -R <hostname>
It works fine for me
add your private key to the ssh-agent with:
ssh-add ~/.ssh/id_rsa
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With