简体   繁体   English

如何从Google Compute Engine访问外部SFTP

[英]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.

相关问题 如何在Google Compute Engine中通过Python访问Google Cloud SQL - How to access Google Cloud SQL by Python in Google Compute Engine 如何允许用户在不公开访问的情况下从Compute Engine下载Google Cloud Storage文件 - How to allow a user to download a Google Cloud Storage file from Compute Engine without public access 如何从浏览器访问在 Google Compute Engine VM 上运行的 Django? - How do I access Django running on a Google Compute Engine VM from my browser? 无法访问谷歌云计算引擎外部 IP 以访问 flask 应用程序 - Can't access Google Cloud Compute engine external IP to access flask app 无法绑定到谷歌计算引擎虚拟机实例的外部 IP 地址 - Cannot bind to external IP address of google compute engine VM instance Google Compute Engine的http请求出现问题 - Trouble with http request from Google Compute Engine 如何在Google Compute Engine上验证BigQuery? - How to auth into BigQuery on Google Compute Engine? 如何将 PyCharm 与 Google 计算引擎结合使用 - How to use PyCharm with Google compute engine 如何通过 Python 3.6 连接和访问 Google Cloud Compute Engine VM - How to connect and access Google Cloud Compute Engine VM via Python 3.6 Google Compute Engine OpenERP - Google Compute Engine OpenERP
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM