"ssh-keygen -R hostname" errors out with non-existent known_hosts

Peter Moody mindrot at hda3.com
Wed Mar 24 13:42:03 AEDT 2021


> Its job is to ensure the next ssh to that host will not have an old
> host key in the way. If there’s no known_hosts file, that’s done.

one could make the same argument about umount; it's job is to make
sure a particular device isn't mounted

  $ umount: /mnt/this-disk-does-not-exist: no mount point specified.
  umount: /mnt/this-disk-does-not-exist: no mount point specified.
  $ echo $?
  32

> If you really need to test whether that file exists… test(1) exists.

and similarly someone could test(1) that ~/.ssh/known_hosts exists
before calling ssh-keygen -R (which honestly seems like the easiest
solution to the original problem)

anyway, this is definitely in the realm of bikeshedding.


More information about the openssh-unix-dev mailing list