Questions tagged «pysftp»

9
使用pysftp验证主机密钥
我正在使用pysftp编写程序,它想针对验证SSH主机密钥C:\Users\JohnCalvin\.ssh\known_hosts。 终端程序使用PuTTY将其保存到Registry中[HKEY_CURRENT_USER\Software\SimonTatham\PuTTY\SshHostKeys]。 如何调和pysftp和PuTTY之间的区别? 我的代码是: import pysftp as sftp def push_file_to_server(): s = sftp.Connection(host='138.99.99.129', username='root', password='*********') local_path = "testme.txt" remote_path = "/home/testme.txt" s.put(local_path, remote_path) s.close() push_file_to_server() 我收到的错误响应是: E:\ Program Files(x86)\ Anaconda3 \ lib \ site-packages \ pysftp__init __。py:61:UserWarning: 无法从C:\ Users \ JohnCalvin.ssh \ known_hosts加载HostKeys。 您将需要显式加载HostKeys(cnopts.hostkeys.load(filename))或disableHostKey检查(cnopts.hostkeys = None)。warnings.warn(wmsg,UserWarning)追溯(最近一次调用最近):push_file_to_server()中第14行的文件“ E:\ OneDrive \ Python …
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.