[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: using ssh_channel_write for command execution problem


yes I have seen exec.c, I believe that ssh_channel_exec() without shell
executes exactly 1 command, but what I am trying to achieve is executing
multiple related commands that put the shell into a certain mode and then
read some data. That's why I request the PTY, then shell and then I would
use multiple ssh_channel_writes.

I think this is not a libssh bug or anything, seems like an environment
issue - libssh sends data correctly, probably the system/server says
everything was sent correctly but the data is never executed on the server.
It's mind-boggling, no idea what could be the cause.

št 7. 11. 2019 o 15:32 Andreas Schneider <asn@xxxxxxxxxxxxxx> napísal(a):

> On Thursday, 7 November 2019 15:27:38 CET Karah Sekir wrote:
> > Hi Andreas,
> >
> > I tried with ssh_channel_exec() (removing the PTY) and I am getting the
> > same behaviour.
> >
> > I should also mention, that I am executing the executable from within a
> > docker container. The libssh logs show as if everything would be sent
> from
> > the libssh point of view, but in fact no command is executed on the ssh
> > server. It is purely stochastic in a sense that it sometimes works (i.e.
> > command is executed on the server). Just a as a sanity check - do you see
> > anything wrong in my code? It should be a vanilla libssh initialization
> and
> > a write. Could it be a unique issue in my environment?
>
> https://git.libssh.org/projects/libssh.git/tree/examples/exec.c
>
> works just fine for me.
>
>
> --
> Andreas Schneider                 asn@xxxxxxxxxxxxxx
> GPG-ID:     8DFF53E18F2ABC8D8F3C92237EE0FC4DCC014E3D
>
>
>

Follow-Ups:
Re: using ssh_channel_write for command execution problemAndreas Schneider <asn@xxxxxxxxxxxxxx>
References:
using ssh_channel_write for command execution problemKarah Sekir <jackiechanaaa@xxxxxxxxx>
Re: using ssh_channel_write for command execution problemAndreas Schneider <asn@xxxxxxxxxxxxxx>
Re: using ssh_channel_write for command execution problemKarah Sekir <jackiechanaaa@xxxxxxxxx>
Re: using ssh_channel_write for command execution problemAndreas Schneider <asn@xxxxxxxxxxxxxx>
Archive administrator: postmaster@lists.cynapses.org