On Mon, Sep 10, 2007 at 12:51:37PM -0400, Paul Thomas wrote: > So I take it no one out there has any idea how to actually get things going > with this library? I can create the shell..now what? Why isn't there a bash > like prompt being sent back to me over the socket?
It is--but it's begin sent encrypted so you need to use libssh2 to read it. > > can get to the point where it can open up a shell on a pty, but > after > that > > suceeds what do I do now? > > > > The guides all say > > /* At this point the shell can be interacted with using > > * libssh2_channel_read() > > * libssh2_channel_read_stderr() > > * libssh2_channel_write() > > * libssh2_channel_write_stderr() > > > > Thats nice, but I expected that after I requested a shell that there > would > > be some data on the socket ready to be read that contained something > like: > > [EMAIL PROTECTED] ~ $ The documentation for those function describes how to use them. The following brute-force hack to the ssh2 example program will display the first bit of data sent by the remote server after a shell connect just to prove that it's possible: --- libssh2/example/simple/ssh2.c Wed Aug 8 18:10:11 2007 +++ ./ssh2.c Mon Sep 10 13:56:56 2007 @@ -217,6 +217,15 @@ * A channel can be closed with: libssh2_channel_close() * A channel can be freed with: libssh2_channel_free() */ + { + int len = 0; + while (len == 0) { + char buf[1024]; + len = libssh2_channel_read(channel, buf, sizeof(buf)); + printf("%*s", len, buf); + } + } + skip_shell: if (channel) { A real implementation would be built on libssh2_poll instead of this dumb busy loop. It would probably be a good idea to update the ssh2 example program to actually behave more like OpenSSH's ssh and allow an actual interactive login session. >>> Dan -- http://www.MoveAnnouncer.com The web change of address service Let webmasters know that your web site has moved ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ libssh2-devel mailing list libssh2-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libssh2-devel