SSH - Login without password, disable warnings

On the machine you want to login FROM:

ssh-keygen

ssh-copy-id -i ~/.ssh/id_rsa.pub <username>@<hostname>

Important: In <username>, fill in the username you want to login as, in <hostname>, fill in the hostname you want to login TO.

You will be asked for password.


Remove WARNING: POSSIBLE DNS SPOOFING DETECTED! / WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! warnings

If you happen to connect to the same hostname but it is running different SSH installations, like if you first boot it from the hard drive and SSH connect to it, and then boot it from an USB live installation and then again SSH connect to it you make SSH suspicious. It then output warnings like:

WARNING: POSSIBLE DNS SPOOFING DETECTED!
WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!

You get a note about an offending key to remove in:
/home/<username>/.ssh/known_hosts:<line number>

You also get a one liner solution:
ssh-keygen -f "/home/<username>ssh/known_hosts" -R <hostname>

But runing this solution will most often not cure the problem completely. When you then try to connect again you get nagging crap about the offending key again.

Turns out you actually can disable these warnings. But it is on a per-user basis. Setting it in the global /etc/ssh/ssh_config will not work.

To disable it, edit ~/.ssh/config and ensure it has this:

Host *
# disable host key checking
  StrictHostKeyChecking   no
# set output loglevel to error
  LogLevel                ERROR
# optional, add host to nowhere, will disable warning but also not log hosts
#  UserKnownHostsFile      /dev/null

Source: https://unix.stackexchange.com/questions/110557/force-ssh-to-not-print-remote-host-identification-has-changed-warning

This is a personal note. Last updated: 2019-06-25 20:04:13.



GitHub

My

GitLab

My

LinkedIn

My

Klebe.se

Don't forget to pay my friend a visit too. Joakim