Atomically move known hosts file into place for paramiko connections

Redo of original patch, which adds an additional check to ensure the
known_hosts file isn't trampled when host_key_checking is disabled.

Fixes #8169