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

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

 



On 24/03/2021 02:42, Peter Moody wrote:
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

Or even just "rm":

$ rm nonexistent
rm: cannot remove 'nonexistent': No such file or directory
$ echo $?
1

But in this case, there is a flag to get the other behaviour.

$ rm -f nonexistent
$ echo $?
0

If the requirement is "to ensure the next ssh to that host will not have an old host key in the way", and you are doing this on every connection to that host, then you could simply ignore the known_hosts file entirely:

host *.foo.bar
  StrictHostKeyChecking no
  UserKnownHostsFile /dev/null
  LogLevel ERROR

I do this for test VMs which are being frequently deleted and recreated.

_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev@xxxxxxxxxxx
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev




[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux