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