curl error语言 - 79 Error in the ssh layer
curl error - 79 Error in the ssh layer
我在c++代码中使用curl库。我想上传一个文件到服务器使用sftp和用户认证。虽然我设法从windows命令行使用
做到这一点curl -k -T f:/temp/openvpn-config.zip -u user:password sftp://fabrika/tmp/
使用options调用curl
struct stat file_info;
FILE *fd = fopen(f:/temp/openvpn-config.zip,"rb");
int res_st = fstat(fileno(fd), &file_info);
fclose(fd);
ffile.open(f:/temp/openvpn-config.zip,ios::in | ios::binary);
curl_easy_setopt(h_curl, CURLOPT_URL, "sftp://fabrika/tmp/");
curl_easy_setopt(h_curl, CURLOPT_UPLOAD, 1L);
curl_easy_setopt(h_curl, CURLOPT_READDATA, (void*)&ffile);
curl_easy_setopt(h_curl, CURLOPT_READFUNCTION, &ReadCallback);
curl_easy_setopt(h_curl, CURLOPT_INFILESIZE_LARGE, (curl_off_t)file_info.st_size);
curl_easy_setopt(h_curl, CURLOPT_SSL_VERIFYPEER, 0L);
curl_easy_setopt(h_curl, CURLOPT_USERPWD, "user:password");
给了我错误代码79,它翻译成"ssh层错误"。我检查了fstat的结果,传递给curl的文件大小是正确的。
编辑:忘记从详细模式添加调试信息,这里是Hostname was NOT found in DNS cache
Adding handle: conn: 0x4236ef0
Adding handle: send: 0
Adding handle: recv: 0
Curl_addHandleToPipeline: length: 1
- Conn 0 (0x4236ef0) send_pipe: 1, recv_pipe: 0
Trying 192.168.3.1...
Connected to fabrika (192.168.3.1) port 22 (#0)
SSH MD5 fingerprint: 9e73dade666cbbac9a82adfeffbd9f18
SSH authentication methods available: publickey,password
Using ssh public key file id_dsa.pub
Using ssh private key file id_dsa
SSH public key authentication failed: Unable to open public key file
Initialized password authentication
Authentication complete
Upload failed: Operation failed (4/-31)
Connection #0 to host fabrika left intact
很明显,我遗漏了一些命令行curl使用的参数,如果有任何建议,我将不胜感激。
切赫
答案:我通过curl邮件列表得到了答案,所以这里是以防有人像我一样被卡住。上传文件时,curl需要完整的目标路径,包括filename。所以
curl_easy_setopt(h_curl, CURLOPT_URL, "sftp://fabrika/tmp/openvpn-config.zip");
似乎您的应用程序无法读取"id_dsa "。因此SSH握手不会完成。尝试查看CURLOPT_CAINFO
相关文章:
- 为什么'allocate in one library and free in the other'是错误的
- 如何修复'The procedure entry point SDL_RWclose could not be located in the dynamic link library'
- 错误:在 MacOS 上"no member named 'uint8_t' in the global namespace"
- "The ordinal 344 could not be located in the dynamic link library"
- 如何从类调用函数 - 错误"was not in the scope"
- "the procedure entry point _ZNSt8_detail15_List_node_base7_M_hookEPS0_ could not be located in the
- 如何修复理性狂想曲错误:"Current value is " VC11 ", but no Visual Studio installation was not found in the direc
- Qt控制台应用程序"WARNING: QApplication was not created in the main() thread"
- 在win2k3上运行.exe时发生"The procedure entry point GetErrorMode could not be located in the dynamic link l
- 我正在开发Arduino Uno。错误:开关外壳的"'RX' not declared in the scope."和"duplicate case value"
- 告诉海湾合作委员会"I want to use SSE4.1, but ONLY in the places I want!"
- COM in the non-Windows world?
- 禁止从模板类的库标头中"Base class ‘class X’ should be explicitly initialized in the copy constructor"
- "virtual base class in the case of multilevel inheritance"有意义吗
- C++ in the cloud. Casablanca REST Service on Microsoft Azure
- 名称查找是否应该"in the class of the object expression"查找该类的成员?
- C++ "Count the number of collisions at each slot in the hash table"
- 如何从我的 C++ 应用程序设置默认主页"in the browser"?
- (更新)QT QML 5.6 - 什么原因导致此警告"QApplication was not created in the main() thread"?
- C++标准措辞:"through all iterators in the range"是否意味着顺序?