Paramiko SFTPClient - setting missing master key policy?

I know with the Paramiko SSHClient class, you can set the laid-back policy of missing hosts like this:

ssh = paramiko.SSHClient() ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) 

However, I open the file stream through SFTP (not SSHClient), for example:

 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 could not find anything in the docs for setting the missing host key policy through Transport or SFTPClient.

Is there a way to get the same using SFTPClient?

Cheers, Victor

+4
source share
1 answer

You can get the SFTP client from the SSH client using open_sftp ().

 ssh = paramiko.SSHClient() ssh.set_missing_host_key_policy( paramiko.AutoAddPolicy()) ftp = ssh.open_sftp() ftp.get('remotefile', 'localfile') 

Although I have not tested this.

+6
source

All Articles