2014-10-11 89 views
0

当我SFTP发布到服务器使用此命令在Linux操作系统Ubuntu:子和调用SFTP命令

sftp -b /path/sftp_put [email protected] 

它的行为正确,但在使用时调用我的Python项目,如:

call(["sftp", "-b","/path/sftp_put",'[email protected]']) 

它不工作,造成此错误:

Host key verification failed. 
Couldn't read packet: Connection reset by peer 
+0

可能是它要求输入密码。 – 2014-10-11 13:45:10

+0

为什么不使用像paramiko这样的python sftp客户端? – Daniel 2014-10-11 16:32:49

回答

0

当您连接到与SFTP/SSH服务器首次你通常要求确认服务器密钥指纹是正确的(这一行为可以在客户端设置进行更改)

例如:

ssh sftp02.domain.com 

The authenticity of host 'ftp02.domain.com (10.90.229.2)' can't be established. ECDSA key fingerprint is 9c:4a:b3:1a:ce:a8:78:81:c6:a1:a1:8b:8f:c0:e0:27. Are you sure you want to continue connecting (yes/no)? yes

您必须验证和密钥将被添加到你的已知主机在服务器密钥更改之前,不会再询问。如果是这种情况,服务器已被重新安装,重新生成密钥或者您被恶意重定向到不同的服务器。