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

Re: using ssh_channel_write for command execution problem


Hi Till,

a very good hint with openssh debug mode. I tried it, but unfortunately the
output is exactly the same in both cases, in one case the command gets
executed (I see it in bash history or I can touch a file and see if it was
created) and it the other it does not. Both have the same output

....
debug1: Setting controlling tty using TIOCSCTTY.
HERE IS THE DATA BEING SENT
debug3: receive packet: type 96 <-- this is just closing the connection
debug2: channel 0: rcvd eof
debug2: channel 0: output open -> drain
debug2: channel 0: obuf empty
debug2: channel 0: close_write
debug2: channel 0: output drain -> closed
debug3: receive packet: type 97
debug2: channel 0: rcvd close
........

I have tried other servers (mock SSH in python) and I am getting the same
behavior -> sometimes I see the command on the server and sometimes it does
not arrive at all (although ssh_channel_write successfully finishes and
writes all bytes).

št 7. 11. 2019 o 16:09 <g4-lisz@xxxxxxxxxxxx> napísal(a):

> On 07.11.19 15:27, 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?
>
> Maybe it's not an issue of your lisssh client... Does it always work
> when you use openssh command to execute the command instead?
>
> Have you enabled logging on the server side? You can start the OpenSSH
> server in debugging mode, without forking to background.
>
> Till
>
>
>
>

Archive administrator: postmaster@lists.cynapses.org