scp 使用 libcurl 失败

问题描述 投票:0回答:1

我正在尝试以编程方式使用由 OpenSSL 1.1.1 和 libssh2 构建的 libcurl 来执行文件的 scp。它在应用程序端失败并出现以下错误。有什么可能出错的提示吗?

Debug details:   Trying 10.30.10.120...
Debug details: TCP_NODELAY set
Debug details: Connected to 10.30.10.120 (10.30.10.120) port 22 (#1)
Debug details: SSH MD5 fingerprint: 140efbdc7794d4c623f87fe4d95fd69f
Debug details: SSH authentication methods available: publickey,password
Debug details: Using SSH private key file ''
Debug details: SSH public key authentication failed: Unable to extract public key from private key file: Unable to open private key file
Debug details: Authentication failure
Debug details: Closing connection 1
ErrorCode=67, ErrorStr=Login denied

在 sshd 服务器端,这是我看到的:

May 02 01:29:20 test-host isshd[2558229]: debug1: Forked child 2702766.
May 02 01:29:20 test-host isshd[2702766]: debug1: Set /proc/self/oom_score_adj to 0
May 02 01:29:20 test-host isshd[2702766]: debug1: rexec start in 5 out 5 newsock 5 pipe 7 sock 8
May 02 01:29:21 test-host isshd[2702766]: debug1: inetd sockets after dupping: 4, 4
May 02 01:29:21 test-host isshd[2702766]: Connection from 10.30.10.120 port 45954 on 10.30.10.120 port 22 rdomain ""
May 02 01:29:21 test-host isshd[2702766]: debug1: Local version string SSH-2.0-OpenSSH_8.2
May 02 01:29:21 test-host isshd[2702766]: debug1: Remote protocol version 2.0, remote software version libssh2_1.10.0
May 02 01:29:21 test-host isshd[2702766]: debug1: no match: libssh2_1.10.0
May 02 01:29:21 test-host isshd[2702766]: debug1: permanently_set_uid: 106/65534 [preauth]
May 02 01:29:21 test-host isshd[2702766]: debug1: list_hostkey_types: ssh-rsa [preauth]
May 02 01:29:21 test-host isshd[2702766]: debug1: SSH2_MSG_KEXINIT sent [preauth]
May 02 01:29:21 test-host isshd[2702766]: debug1: SSH2_MSG_KEXINIT received [preauth]
May 02 01:29:21 test-host isshd[2702766]: debug1: kex: algorithm: curve25519-sha256 [preauth]
May 02 01:29:21 test-host isshd[2702766]: debug1: kex: host key algorithm: ssh-rsa [preauth]
May 02 01:29:21 test-host isshd[2702766]: debug1: kex: client->server cipher: aes128-ctr MAC: hmac-sha2-256 compression: none [preauth]
May 02 01:29:21 test-host isshd[2702766]: debug1: kex: server->client cipher: aes128-ctr MAC: hmac-sha2-256 compression: none [preauth]
May 02 01:29:21 test-host isshd[2702766]: debug1: expecting SSH2_MSG_KEX_ECDH_INIT [preauth]
May 02 01:29:21 test-host isshd[2702766]: debug1: rekey out after 4294967296 blocks [preauth]
May 02 01:29:21 test-host isshd[2702766]: debug1: SSH2_MSG_NEWKEYS sent [preauth]
May 02 01:29:21 test-host isshd[2702766]: debug1: expecting SSH2_MSG_NEWKEYS [preauth]
May 02 01:29:21 test-host isshd[2702766]: debug1: SSH2_MSG_NEWKEYS received [preauth]
May 02 01:29:21 test-host isshd[2702766]: debug1: rekey in after 4294967296 blocks [preauth]
May 02 01:29:21 test-host isshd[2702766]: debug1: KEX done [preauth]
May 02 01:29:21 test-host isshd[2702766]: debug1: userauth-request for user admin service ssh-connection method none [preauth]
May 02 01:29:21 test-host isshd[2702766]: debug1: attempt 0 failures 0 [preauth]
May 02 01:29:21 test-host isshd[2702766]: error: failed to fetch pwnam using the actual username - trying user xshell\n
May 02 01:29:21 test-host isshd[2702766]: debug1: PAM: initializing for "admin"
May 02 01:29:21 test-host isshd[2702766]: PAM _pam_load_conf_file: unable to open config for /etc/pam.d/system-auth
May 02 01:29:21 test-host isshd[2702766]: debug1: PAM: setting PAM_RHOST to "10.30.10.120"
May 02 01:29:21 test-host isshd[2702766]: debug1: PAM: setting PAM_TTY to "ssh"
May 02 01:29:21 test-host isshd[2702766]: debug1: userauth_send_banner: sent [preauth]
May 02 01:29:21 test-host isshd[2702766]: debug1: PAM: password authentication failed for admin: Authentication failure
May 02 01:29:21 test-host isshd[2702766]: Failed none for admin from 10.30.10.120 port 45954 ssh2
May 02 01:29:21 test-host isshd[2702766]: Connection closed by authenticating user admin 10.30.10.120 port 45954 [preauth]
May 02 01:29:21 test-host isshd[2702766]: debug1: do_cleanup [preauth]
May 02 01:29:21 test-host isshd[2702766]: debug1: sshpam_handle is NULL [preauth]
May 02 01:29:21 test-host isshd[2702766]: debug1: monitor_read_log: child log fd closed
May 02 01:29:21 test-host isshd[2702766]: debug1: do_cleanup
May 02 01:29:21 test-host isshd[2702766]: debug1: PAM: cleanup
May 02 01:29:21 test-host isshd[2702766]: debug1: PAM: closing session
May 02 01:29:21 test-host isshd[2702766]: debug1: Killing privsep child 2702773
May 02 01:29:21 test-host isshd[2558229]: debug1: main_sigchld_handler: Child exited
libcurl libssh2
1个回答
0
投票

对我来说,这是使用旧版本 libcurl 的问题。将 libcurl 升级到最新版本 7.68 后,一切正常。

© www.soinside.com 2019 - 2024. All rights reserved.