0

I'm using Python 3, on Windows, and using pysftp.

Basically, I'm looking for very simple way in Python to connect to an SFTP server and save it's host key to a file that can be used with pysftp in the future.

Some quick notes:

  • I know I can set hostkeys = None in pysftp to bypass the problem when connecting to do actual normal ftp functions (upload, download, etc). I'd rather not do that.

  • Sample sftp public servers can be found here if you want to test anything: https://www.sftp.net/public-online-sftp-servers

  • I know there are other programs that can do this for me (for instance, multiple ftp clients). I'm explicitly looking to do this in Python code, in the simplest way possible.

Any help would be very appreciated. :-)

CyberTaco
  • 338
  • 1
  • 3
  • 14
  • I was going to edit out simple. But I think it would be better for you to do that. You don't need a simple way. You need a way that works. – Dan D. Sep 25 '19 at 22:09
  • I need a way that is both. :-) – CyberTaco Sep 26 '19 at 01:19
  • (I see too many answers on this site that take the four line solution to a problem and wrap it in a 40 line convoluted sample program containing multiple functions and wrapped in classes and with variable names like "ch" and "d". That's great for someone who's been programming python for years. That's horrible for someone who's new to the language and desperately needs help. :-) ) – CyberTaco Sep 26 '19 at 01:24
  • (I don't disagree but rather than ask for a simple answer which makes the question subjective, you are supposed to accept only the answer that is simple enough.) – Dan D. Sep 26 '19 at 06:16
  • Martin: Nice, thank you! Dan: Hmm. Thank you, that's an interesting point. I'll have to think about that a bit. – CyberTaco Sep 26 '19 at 18:52

0 Answers0