Connecting to an SFTP server using pysftp and Python 3 with just the server fingerprint
问题 I'm in kind of a bizarre situation where I need to connect to an SFTP server for the first time but I can't seem to find a way to get access to the known host entry for the server.I can connect fine if I say: import pysftp cnopts = pysftp.CnOpts() cnopts.hostkeys = None with pysftp.Connection('host', username='me', password='pass', cnopts=cnopts): But apparently that leaves you open to man in the middle attacks. So I attempt to connect with: cnopts = pysftp.CnOpts(knownhosts='config/known