Hello! In my program, I need to execute more commands in one channel. So I used the example ssh2_exec and added second command execution. Like this: ... libssh2_session_set_blocking(session, 1);
channel = libssh2_channel_open_session(session); if( channel == NULL ) exit(1); // first command executing -- changing a directory if(rc = libssh2_channel_exec(channel, "cd Projects")) { exit(1); } do { char buffer[0x4000]; rc = libssh2_channel_read( channel, buffer, sizeof(buffer) ); if( rc > 0 ) { int i; bytecount += rc; fprintf(stdout, "We read:\n"); for( i=0; i < rc; ++i ) fputc( buffer[i], stdout); fprintf(stdout, "\n"); } } while( rc > 0 ); // second command executing if( rc = libssh2_channel_exec(channel, "ls -l")) { exit(1); } and here I get error LIBSSH2_ERROR_CHANNEL_REQUEST_DENIED. I'm using libssh2-1.2.7 version on Ubuntu 10.04. Thank you!
_______________________________________________ libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel