[英]How to access an external SFTP from Google Compute Engine
I'm setting a process using python on GCE that must connect to my local SFTP and copy files from there. 我正在GCE上设置一个使用python的进程,它必须连接到我的本地SFTP并从那里复制文件。
I'm using pysftp but getting a SSH problem. 我正在使用pysftp但遇到SSH问题。 What am I doing wrong?
我究竟做错了什么?
>>> import pysftp
>>> sftp = pysftp.Connection(host, username=user, password=pasw)
Exception AttributeError: "'Connection' object has no attribute '_sftp_live'" in <bound method Connection.__del_
_ of <pysftp.Connection object at 0x7feaa86c5b90>> ignored
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/pysftp/__init__.py", line 132, in __init__
self._tconnect['hostkey'] = self._cnopts.get_hostkey(host)
File "/usr/local/lib/python2.7/dist-packages/pysftp/__init__.py", line 71, in get_hostkey
raise SSHException("No hostkey for host %s found." % host)
paramiko.ssh_exception.SSHException: No hostkey for host sftp.mynet.com found.
Manualy adding the SSH Key to known_hosts did the trick. 手动将SSH密钥添加到known_hosts就可以了。
$ ssh sftp.mydomain.com
Would appreciate if someone post a solution where pysftp do this automaticaly 如果有人发布了pysftp自动执行此操作的解决方案,我将不胜感激
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.