Skip to content Skip to sidebar Skip to footer

When And Why To Use Load_host_keys And Load_system_host_keys?

I am connecting to a host for the first time using its private key file. Do I need to call load_host_keys function before connecting to the host? Or Can I just skip it? I have the

Solution 1:

Load host keys from a local host-key file. Host keys read with this method will be checked after keys loaded via load_system_host_keys, but will be saved back by save_host_keys (so they can be modified). The missing host key policy AutoAddPolicy adds keys to this set and saves them, when connecting to a previously-unknown server.

This method can be called multiple times. Each new set of host keys will be merged with the existing set (new replacing old if there are conflicts). When automatically saving, the last hostname is used.

Read a file of known SSH host keys, in the format used by openssh. This type of file unfortunately doesn't exist on Windows, but on posix, it will usually be stored in os.path.expanduser("~/.ssh/known_hosts").

Post a Comment for "When And Why To Use Load_host_keys And Load_system_host_keys?"