记录一个curl 错误:Failure connecting to agent
报错如下,采用C语言编程调用curl库事项sftp相关功能函数,在实测时的反馈:
* Trying 192.168.***.***...
* Connected to someurl.com (192.168.***.***) port 22 (#0)
* SSH MD5 fingerprint: 6831eae63f230952a1775e0f67f80e7b
* SSH authentication methods available: publickey,password
* Using SSH private key file '/home/user/.ssh/id_rsa'
* SSH public key authentication failed: Unable to extract public key from private key file: Unable to open private key file
* Failure connecting to agent
* Authentication failure
* Closing connection 0
虽然看起来有个读私钥的错误,但是按照curl的stp协议的流程私钥不通过,会使用用户名及密码尝试获取授权,请检查用户名及密码是否正确,用户名及密码错误不会报告与之相关的错误,只会显示授权失败。
* Trying 192.168.***.***...
* Connected to anotherurl.com (192.168.***.***) port 22 (#0)
* SSH MD5 fingerprint: bcf5632dc06c0353849b745822c4889a
* SSH authentication methods available: password,publickey
* Using SSH private key file '/home/user/.ssh/id_rsa'
* SSH public key authentication failed: Unable to extract public key from private key file: Unable to open private key file
* Initialized password authentication
* Authentication complete