# Curl and libssh2

**URL:** <https://forum.legato.io/t/curl-and-libssh2/3857>\
**Category:** Legato Linux distribution (Yocto project)\
**Created:** [November 7, 2018, 2:45am UTC](https://forum.legato.io/t/curl-and-libssh2/3857 "2018-11-07T02:45:41Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![shib](https://avatars.discourse-cdn.com/v4/letter/s/f6c823/32.png) [@shib](https://forum.legato.io/u/shib)\
**Post date:** [November 7, 2018, 2:45am UTC](https://forum.legato.io/t/curl-and-libssh2/3857/1 "2018-11-07T02:45:41Z")

</div>

I have modified WP77XX firmware release 9.1 to allow SFTP by adding libssh2 to curls PACKAGECONFIG.  
When I try to connect to an sftp server libssh2 is returning the error LIBSSH2\_ERROR\_SOCKET\_RECV  
Does anybody know what might cause this?

---

<div class="post-metadata">

**Author:** ![muralinagraj](https://avatars.discourse-cdn.com/v4/letter/m/45deac/32.png) [@muralinagraj](https://forum.legato.io/u/muralinagraj)\
**Post date:** [November 14, 2018, 9:47am UTC](https://forum.legato.io/t/curl-and-libssh2/3857/2 "2018-11-14T09:47:03Z")

</div>

Hi @shib,  
When we tried with WP7702 to connect to sftp using the “curl -v -k -u demo:password sftp://test.rebex.net” , It fails to connect to sftp throwing an error “Failure establishing ssh session”

Below are the complete logs, Please confirm whether you also see the same logs. We are looking into it.

```
root@swi-mdm9x28-wp:~# curl -v -k -u demo:password sftp://test.rebex.net
* Rebuilt URL to: sftp://test.rebex.net/
* Trying 195.144.107.198...
* TCP_NODELAY set
* Connected to test.rebex.net (195.144.107.198) port 22 (#0)
* Failure establishing ssh session
* Closing connection 0
curl: (2) Failure establishing ssh session

```

Regards,  
Muralidhara N.

---

<div class="post-metadata">

**Author:** ![shib](https://avatars.discourse-cdn.com/v4/letter/s/f6c823/32.png) [@shib](https://forum.legato.io/u/shib)\
**Post date:** [November 14, 2018, 9:45pm UTC](https://forum.legato.io/t/curl-and-libssh2/3857/3 "2018-11-14T21:45:11Z")

</div>

Hi Muralidhara,

This is the same error that I was experiencing.  
To find out what error code libssh2 was emitting, I created and applied this patch:

```auto
--- a/lib/ssh.c	2018-07-09 16:42:12.000000000 +1000
+++ b/lib/ssh.c	2018-11-07 12:51:09.245299347 +1100
@@ -667,7 +667,7 @@
         break;
       }
       if(rc) {
- failf(data, "Failure establishing ssh session");
+ failf(data, "Failure establishing ssh session, error %d", rc);
         state(conn, SSH_SESSION_FREE);
         sshc->actualcode = CURLE_FAILED_INIT;
         break;

```

I just called it libssh2-debug.patch and added it to the SRC\_URI of curl\_7.58.0bb.  
Running the previous command with that patch applied shows libssh2 returning with error -43, LIBSSH2\_ERROR\_SOCKET\_RECV.  
That was as far as I got debugging this issue.

---

<div class="post-metadata">

**Author:** ![muralinagraj](https://avatars.discourse-cdn.com/v4/letter/m/45deac/32.png) [@muralinagraj](https://forum.legato.io/u/muralinagraj)\
**Post date:** [November 15, 2018, 9:23am UTC](https://forum.legato.io/t/curl-and-libssh2/3857/4 "2018-11-15T09:23:28Z")

</div>

Hi @shib,  
Thanks for the clarification, Even we see same error --43 is returned when we tried printing the error code.

We are trying looking into this, Will let you know for any further updates.

Regards,  
Muralidhara N.

---

<div class="post-metadata">

**Author:** ![shib](https://avatars.discourse-cdn.com/v4/letter/s/f6c823/32.png) [@shib](https://forum.legato.io/u/shib)\
**Post date:** [November 26, 2018, 3:29am UTC](https://forum.legato.io/t/curl-and-libssh2/3857/5 "2018-11-26T03:29:52Z")

</div>

Hello Muralidhara,

I know you said you would let me know if there were any updates, but i’m going to ask anyway.  
Are there any updates?

---

<div class="post-metadata">

**Author:** ![muralinagraj](https://avatars.discourse-cdn.com/v4/letter/m/45deac/32.png) [@muralinagraj](https://forum.legato.io/u/muralinagraj)\
**Post date:** [December 5, 2018, 12:23pm UTC](https://forum.legato.io/t/curl-and-libssh2/3857/6 "2018-12-05T12:23:34Z")

</div>

Hi @shib,  
We had informed this to our R&D, They have suggested to try access over ecm.  
Officially we don’t support SFTP, But our R&D team trying to look further into this issue depending on the bandwidth they have.

Regards,  
Muralidhara N.

---

<div class="post-metadata">

**Author:** ![shib](https://avatars.discourse-cdn.com/v4/letter/s/f6c823/32.png) [@shib](https://forum.legato.io/u/shib)\
**Post date:** [December 5, 2018, 9:48pm UTC](https://forum.legato.io/t/curl-and-libssh2/3857/7 "2018-12-05T21:48:23Z")

</div>

Hi Muralidhara.

What is ecm?

You say that you don’t officially support SFTP, but you include an SFTP server on the device?  
I appreciate you passing the issue on to R&D. This is a deal breaker for us, if there is any way to expedite the issue through some paid support, can you please PM me some details?

Thanks.

---

<div class="post-metadata">

**Author:** ![muralinagraj](https://avatars.discourse-cdn.com/v4/letter/m/45deac/32.png) [@muralinagraj](https://forum.legato.io/u/muralinagraj)\
**Post date:** [December 7, 2018, 7:14am UTC](https://forum.legato.io/t/curl-and-libssh2/3857/8 "2018-12-07T07:14:29Z")

</div>

Hi @shib,  
We have informed the same(expedite the issue through some paid support) to our R&D, Will let you know once they come back with the details.

Regards,  
Muralidhara N.
