curl:(2)初始化sftp会话失败:无法发送SSH_FXP_INIT



我在Red Hat 5.7服务器上使用curl从各个公司下载文件。

但是有一个连接给了我以下错误(匿名):

curl -v -u 'anonymous:' sftp://sftp.acme.com/
* About to connect() to sftp.acme.com port 22 (#0)
*   Trying x.x.x.x...
* connected
* Connected to sftp.acme.com (x.x.x.x) port 22 (#0)
* SSH MD5 fingerprint: 95febe8759c980cd9526ec2b90....
* SSH host check: 0, key: AAAAB3NzaC1yc2EAAAADAQA....
* SSH authentication methods available: publickey,password,keyboard-interactive
* Using ssh public key file /home/lanes/.ssh/id_rsa.pub
* Using ssh private key file /home/lanes/.ssh/id_rsa
* Initialized SSH public key authentication
* Authentication complete
* Failure initializing sftp session: Unable to send SSH_FXP_INIT
* Closing connection #0
curl: (2) Failure initializing sftp session: Unable to send SSH_FXP_INIT

sftp works fine:

sftp anonymous@sftp.acme.com
Connecting to sftp.acme.com...
ACME File Transfer Prod #1
sftp> quit

有人见过这个SSH_FXP_INIT错误吗?


curl --version
curl 7.24.0 (x86_64-redhat-linux-gnu) libcurl/7.24.0 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5 libssh2/1.2.2
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp scp sftp smtp smtps telnet tftp
Features: IDN IPv6 Largefile NTLM NTLM_WB SSL libz

详细sftp输出:

sftp -v anonymous@sftp.acme.com
Connecting to sftp.acme.com...
OpenSSH_4.3p2, OpenSSL 0.9.8e-fips-rhel5 01 Jul 2008
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to sftp.acme.com [139.149.22.130] port 22.
debug1: Connection established.
debug1: identity file /home/lanes/.ssh/id_rsa type 1
debug1: identity file /home/lanes/.ssh/id_dsa type -1
debug1: loaded 2 keys
debug1: Remote protocol version 2.0, remote software version SSHD
debug1: no match: SSHD
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_4.3
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-cbc hmac-md5 none
debug1: kex: client->server aes128-cbc hmac-md5 none
debug1: sending SSH2_MSG_KEXDH_INIT
debug1: expecting SSH2_MSG_KEXDH_REPLY
debug1: Host 'sftp.acme.com' is known and matches the RSA host key.
debug1: Found key in /home/lanes/.ssh/known_hosts:23
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
UBS File Transfer Prod #2
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Next authentication method: publickey
debug1: Offering public key: /home/lanes/.ssh/id_rsa
debug1: Server accepts key: pkalg ssh-rsa blen 277
debug1: read PEM private key done: type RSA
debug1: Authentication succeeded (publickey).
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
debug1: Sending environment.
debug1: Sending env LANG = en_US.UTF-8
debug1: Sending subsystem: sftp

可以用psftp连接到服务器吗?如果是这样的话,看看PuTTY日志是怎么说的会很有趣。

最新更新