I know with Paramiko's SSHClient class, you can set a relaxed missing host key policy like so:
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
However, I'm opening a file stream via SFTP (not SSHClient), like so:
t = paramiko.Transport((process['hostname'], 22))
keyfile = paramiko.DSSKey.from_private_key_file('./id_dsa')
t.connect(username = 'user', pkey = keyfile)
sftp = paramiko.SFTPClient.from_transport(t)
I couldn't locate anything in the docs for setting a missing host key policy via Transport, or SFTPClient.
Is there any way to achieve the same thing using SFTPClient?
Cheers, Victor
One can get SFTP client from SSH client by using open_sftp()
.
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
sftp = ssh.open_sftp()
sftp.get('remotefile', 'localfile')
Though I haven't tested this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With