I am using Paramiko for sshing from Python script. My ssh
command is listed below:
ssh -A -o strictHostKeyChecking=no <hostname>
I need same Paramiko code for Python.
In Paramiko, an equivalent of OpenSSH StrictHostKeyChecking=no
is the default behaviour of MissingHostKeyPolicy
, which implements missing_host_key
to simply do nothing.
client = paramiko.SSHClient()
client.set_missing_host_key_policy(paramiko.MissingHostKeyPolicy())
client.connect(hostname, ...)
Though you should not do this (and neither StrictHostKeyChecking=no
). You are losing a protection against Man-in-the-middle attacks this way. For correct solution, see Paramiko "Unknown Server".