使用pysftp而不压缩或以指定的压缩方式使用

2024-05-17 06:23:17 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试使用pysftp连接到服务器以传输文件。 每次我跑步

con = pysftp.Connection('ftp.abc.com', username='user', password='my_pass')

我得到SSHException的意思是ssh服务器不兼容,这很可能是因为使用了(或没有使用)压缩。在

^{pr2}$

这不是服务器本身的问题,因为当我运行sftp -v ftp.abc.com时,我得到以下输出:

OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
...
debug1: Connection established.
...
...
...
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2
debug1: Remote protocol version 2.0, remote software version JSCAPE
debug1: no match: JSCAPE
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client 3des-cbc hmac-md5 zlib
debug1: kex: client->server 3des-cbc hmac-md5 zlib
debug1: sending SSH2_MSG_KEXDH_INIT
debug1: expecting SSH2_MSG_KEXDH_REPLY
debug1: Server host key: ...
debug1: Host ... is known and matches the RSA host key.
debug1: Found key in /home/.../.ssh/known_hosts:3
debug1: ssh_rsa_verify: signature correct
debug1: Enabling compression at level 6.
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: password
debug1: Next authentication method: password

输入密码后,它可以正常工作。在

我做了一些阅读并尝试在没有压缩的情况下sftping到服务器中,但是我不能。即使在我更改了ssh_config文件并在命令行指定了-oCompression=no之后,它也始终启用压缩。在

那么,如何在不使用压缩的情况下连接呢?更重要的是,有没有一种方法可以在压缩级别设置为6的情况下使用pysftp?在


Tags: key服务器configssh2serverversion情况msg
1条回答
网友
1楼 · 发布于 2024-05-17 06:23:17

我整理了帕拉米科的部分。在

我下载了source code,然后我不得不将_preferred_compression改为{}。默认设置为none。在

在帕拉米科102号线/运输.py,我换了线

_preferred_compression = ('none',)

^{pr2}$

它成功了,但我不知道为什么帕拉米科不能与它谈判。在

关于在不压缩的情况下运行sftp的部分仍然没有答案。 任何帮助都将不胜感激。在

相关问题 更多 >