Salvador Fandiño | 1 Sep 10:25 2015

The Perl & SSH hachathon


As part of the YAPC::Europe::2015 happening this week on Granada, we are 
organizing a small hackathon with the "Perl & SSH" theme on Saturday.

The idea is to bring together people interested in that area to improve 
the current state of SSH related Perl modules and specifically, 
Net::SSH2, the Perl wrapper for libssh2.

So, any one from the libssh2 community is welcome to participate via IRC 
or in person, if you happen to be around. No Perl knowledge required. We 
would definitively appreciate having some libssh2 developer at hand to 
take a look into any libssh2 issue found (if any!).

In order to attend via IRC you don't really need to register on the 
conference website, just show up on the channel on the hackathon day!


Engstrom, John | 1 Sep 00:19 2015

OS X Crash in libssh2_session_startup() - EXC_BAD_ACCESS (code=1 address=0x0)

I have an application that is using libssh2 and when I call into libssh2_session_startup() I’m crashing.  The calling code looks like this:

  LIBSSH2_SESSION **session;
  *session = libssh2_session_init_ex(ssh_alloc, ssh_free, ssh_realloc, name);
  if (*session) {
    //set a timeout so we can bail if we try to talk to something that isn't SSH
    libssh2_session_set_timeout(*session, 60000); // 60 sec
    if (libssh2_session_startup(*session, (int)socket)) {

The stack trace of the crash is:
#0 0x0000000000000000 in 0x00000000 ()
#1 0x0000000101354380 in diffie_hellman_sha1 ()
#2 0x0000000101356765 in kex_method_diffie_hellman_group14_sha1_key_exchange ()
#3 0x00000001013522bf in _libssh2_kex_exchange ()
#4 0x000000010135e2fe in session_startup ()
#5 0x000000010135e088 in libssh2_session_handshake ()
#6 0x000000010135e5db in libssh2_session_startup ()

Any suggestions on what might be going on or what I could do to diagnose it?

John Engstrom

Matthew Voss | 28 Aug 01:07 2015

Windows Build

Hi All,

I've been Googling around for a build procedure to use with VS2010 or
higher. I found this:
. Unfortunately, it fails with linking errors. Has anyone managed to
build LibSSH2 under Visual Studio?

Salvador Fandino | 26 Aug 14:31 2015

[PATCH] Detect bad usage of libssh2_channel_process_startup

See the patch attached for the details.

Kishore Av | 26 Aug 08:11 2015

Add entry in known host file

If I'm trying to connect  server at first time, no entry is availed in .ssh/known-hosts file.
Using checkp method, i got info about NOTFOUND.
I used knownhost addc method and writefile method to add new entry of server key.
But it's seems, my understanding might be wrong.
How can i get host key of new server and add it in .ssh/known-hosts file???

Thanks in Advance

On 09-Aug-2015 12:38 am, "Peter Stuge" <> wrote:
Kishore Av wrote:
> I using libssh2_channel_request_pty tried with asci, vanilla, vt-100
> terminal types.

Then your software must also implement correct and complete terminal
emulation for the type you request.

> After writing the data, I used looping to read data

Terminals aren't so simple, and a pty channel will be running a shell
intended for communication with humans and not with a program such as

It is extremely fragile and error-prone to try to automate anything
around an interactive shell. Use a dedicated server-side process and
protocol instead.

> actual data size is 68kb, but it reads 10240 bytes.

Can you verify that this happens also by modifying the example/ssh2.c
program in the libssh2 source tree?

> For some commands, I'm not getting any read response as i getting
> when i execute manually.

When you execute "manually" the terminal emulation code path is
*significantly* different, that can not be compared with raw write to
a pty.

> Can any one suggest me the idea how i need to implement this problem.

For a reliable solution you need to have a special program (either
custom-made or a standard one but one which is made to explicitly
support automation) running on the server side, and communicate with
that software using a custom or a standard protocol, also one that is
made for automation of the tasks and actions that you want to automate.

Stef Bon | 25 Aug 21:18 2015

Question about an eventloop.


I'm writing a fuse fs using libssh2. It looks good. First I've tried libssh, but found it not so handy. With libssh2 I can use calls like libssh2_sftp_stat_ex and libssh2_sftp_readdir_ex.
With libssh I found it  more difficult.

I have some questions:

- for receiving data the call _libssh2_channel_read is used. As far as I can see this reads everything incoming (using _libssh2_transport_read), and puts those on a queue (session->packets). _libssh2_channel_read picks those packets which are related to a stream_id.
This is correct?
Why an eventloop is not used? This can put packets on the queue, and signal waiting threads when a receiving message is complete, or even launch a thread to process the message.
( a message is for me a complete package, with header and data). 

- is there a possibility to implement xattrs like getxattr and setxattr. I've posted earlier on the libssh maillist about this, and it's (theoretical) possible using an extension, which the server has to support also. (for example I do not see anything on libssh2 documented about this. This is left out, or not (yet) possible with libssh2?

Salvador Fandiño | 23 Aug 21:00 2015

[PATCH] Fix off-by-one error when reading public key from file

See the patch attached.

It was originally reported as a bug against the Perl wrapping model 
Net::SSH2 here:

libssh2 Trac | 18 Aug 16:12 2015

#308: Agent forwarding not working

#308: Agent forwarding not working
 Reporter:  Nikunj  |       Owner:
     Type:  defect  |      Status:  new
 Priority:  normal  |   Milestone:  1.5.0
Component:  API     |     Version:  1.5.0
 Keywords:          |  Blocked By:
   Blocks:          |
 I am using libssh2 library to ssh connections in my mobile application.
 Here I want to use Agent Forwarding support.

 I have followed same procedure as they have provided in example here

 I am able to create agent successfully but when I try to connect it with
 libssh2_agent_connect(agent) It gives me error -39 LIBSSH2_ERROR_BAD_USE.

 Please suggest if anything wrong. Or what's the correct flow please
 suggest to use.



Ticket URL: <>
libssh2 <>
C library for writing portable SSH2 clients

Alexander Lamaison | 18 Aug 12:31 2015

Github notifications

Hi Daniel,

Could you set up github to email the list when new issues or PRs are opened there? It's useful for people who don't check github every day. This has worked well with Trac in the past.


Kishore Av | 8 Aug 20:35 2015

Libssh2 channel read issue using with pty request

Hello sir,
Thanks for all kind responses.
Here is my observation and doubts,
I using libssh2_channel_request_pty tried with asci, vanilla, vt-100 terminal types.
After writing the data,
I used looping to read data (libssh2_chnnel_read)until "data available in channel" using libssh2 poll read api.
actual data size is 68kb, but it reads 10240 bytes. Even if i try to increase the buffet size, it exactly reading 10240.

For some commands, I'm not getting any read response as i getting when i execute manually.

Can any one suggest me the idea how i need to implement this problem.

Expected: should read actual bytes, say 68kb for show logging.

Ismail Aseen | 30 Jul 19:11 2015

libssh2 nonblocking sftp write fails with Tectia SFTP server in Windows

Hi All,

I used the example code sftp_write_nonblock.c and tried to upload a large file(around 1 gb) to a Tectia SFTP server in Windows box, it failed around 300MB.
 This same program works fine with a linux SFTP server and  the linux sftp client can write the same file to Tectia server too. This 300MB value is when the below highlighted buffer is 30000 (i.e. if I call the sftp write with a 30000 sized data buffer). If I changed it to 1 the transfer get stuck at 11K, when the buffer is 2 then the transfer freezing  size is 21K. In both ends connection is not ended but it waits without any progress. Could you all help me to figure out what is the problem with this Tectia - Libssh2 combination.