Programmatic interface to ssh

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I'm modifying a program that previously used a telnet connection to
communicate to a server.  The program had control of input and output
to the telnet session, as if a user was typing at a command prompt.  In
general a program using telnet is sometimes called an MML or CLI
interface [man-machine language or command-line interface].

My mission is to replace telnet with ssh.  I have searched this group
and the OpenSSH and OpenSSL sites for some time and there seems to be
no library that allows a program to access an ssh shell.

One idea I had was to pore over Putty code to see how the Putty program
uses OpenSSL or OpenSSH libraries to achieve a command-line interface,
and figure out how to rewire it so the program has control of input and

I had hoped that when the program runs it could use the ~/.ssh
directory files or else fallback to password login to the remote

Is there a good way to program to ssh?  There seems to be no library
for a program to do this sort of thing.

Re: Programmatic interface to ssh

Quoted text here. Click to load it

It doesn't.  It has an independent implementation of the SSH protocol built
into it.

Quoted text here. Click to load it

You can always run Plink in a pair of pipes.

Quoted text here. Click to load it

There's libssh: <

I've no idea if it's any use.

Ben Harris

Re: Programmatic interface to ssh

Quoted text here. Click to load it

There is also this:

I've been using perl to drive different versions of SSH over the last
few years.  Because of the different command-lines and so on it would
be easier to use only one version (but that's outside my control).

But I would like to throw custard over the developers who use a 0 return
code on failure.

Elvis Notargiacomo  master AT barefaced DOT cheek /
    Powergen write "Why not stay with us" - let me count the ways!

Site Timeline