Subject: Re: [libssh2] Libssh2 status / documentation request

Re: [libssh2] Libssh2 status / documentation request

From: Sara Golemon <>
Date: Thu, 18 Jan 2007 18:36:53 -0800

> First, I'm wondering if there's any further documentation or examples of
> how to go about using libssh2 in a serious program, particularly for
> terminal emulation support. The ssh2_sample.c kind of skimps out on
> that area, instead just saying that "this is where stuff happens". The
> API documentation is decent, but there's not a lot of help in how to use
> that API. (As a side note, any chance you could include the API docs in
> the distribution so they are available offline? I wound up copying and
> pasting the individual wiki pages into three or four HTML documents
> earlier today so I could have them on-hand.)
Well, the reference implementation for using libssh2 would probably be
the PHP module ( though figuring out where to
start with that might be a PITA...

I'd like to get more bite-sized examples added to the Wiki, but it's all
about prioritization and I haven't even personally had time for coding
on libssh2 for the past six months (though others have been doing work
in that arena).

> Second, one of the things I'm going to want to do is send the SSH
> "window-change" command, which tells the server that the local terminal
> has been resized. This is defined in the SSH spec as sending the words
> "window-change", followed by a series of four integers defining the new
> number of rows and columns. Aris Adamantiadis' libssh has support for
> this (see
> ), but I don't see any explicit support for this in libssh2. I'm
> guessing I'd have to set up a very specific character buffer and pass it
> to libssh2_channel_write_ex, but I'm not 100% sure on that. Any
> suggestions?
I vaguely recall adding that command, but....hrmmm.... Perhaps not....
In any event it should be trivial to add, it's just a question of going
back to the spec and sending the right bytes in the right order. 95%
copy/paste (Though, for the record, not with libssh2_channel_write_ex(),
window-change events are an out of band piece of in formation).

> Third, I saw a few comments about possible slowness in some connections,
> comments about blocking and non-blocking connections, and some
> discussions of possible API changes. What's up with these areas, and
> are there any plans for major changes in the near future?
Well, SCP is definitely broken. It works in like 80% of cases, but
fails seemingly at random. I blame this on the secsh spec which simply
describes it as "RCP over an ssh channel" which... is great and all....
so long as you have specs for RSH... which I...well...don't.

The good news is that SFTP support *does* work, quite well, and it's far
more robust than SCP could ever be. If nothing else, you can implement
SCP as an SFTP transfer (so long as you're willing to fib to your users
a little tiny bit).

Speed is being improved somewhat, but the fact is that dedicated clients
will always be faster because they can manage scatter-shot style file
transfers and resumption and non-blocking reads/write better than a
general purpose library can.

> Finally, I'd appreciate any suggestions or tips you might have in going
> about this process and using the library.
In general, I'd recommend brewing some coffee and sitting down with the
secsh drafts over a weekend and getting to know the protocol intimately.
  Understanding the design concepts which go into the ssh2 protocol will
allow you to understand how to use it (particularly how to use it via
libssh2) much better.

And always, you're welcome to pose any questions you like here, or grab
me on IRC (Freenode/#libssh2) I'm /generally/ there noon to late-night
M-F U.S. Pacific time (-0800).


Note: I'll be heavily AFK tonight thanks to a wonky laptop.

Take Surveys. Earn Cash. Influence the Future of IT
Join's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
libssh2-devel mailing list
Received on 2007-01-19