Subject: Example suggestion - ssh2_exec.c

Example suggestion - ssh2_exec.c

From: Paulo Caetano <>
Date: Thu, 17 May 2012 16:00:19 +0100


I've started a small project that involves connecting to a remote host
via ssh2 and executing several commands.

I've done some searching, and while I didn't find any working example,
I did find several answers to similar questions that mentioned
ssh2_exec.c, in the examples.

So, I've made a small adaptation of the ssh2_exec.c example, to
execute several commands on the remote host, instead of just one.

The code is the same, I've just isolated the channel life cycle &
command execution in a separate function, and added code to read a
list of commands from a file and execute them sequentially.

If you think this is useful/relevant to add to the examples, I'll
gladly submit it.

Last, but not least, a great "thank you" to everyone involved in
manintaining libssh2.

Paulo Caetano.
Received on 2012-05-17