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

Re: Keep alive the session after remote execution of the commands


Hi Andreas,
Thank you very much
I will test it .

Best regards,
Javad

On Fri, Jul 1, 2022, 11:20 Andreas Schneider <asn@xxxxxxxxxxxxxx> wrote:

> On Thursday, June 30, 2022 10:42:59 AM CEST Javad Rahimi wrote:
> > Hello,
>
> Hi,
>
> > We have developed a simple ssh client application based on this
> > <https://api.libssh.org/stable/libssh_tutor_command.html> example
> (libssh:
> > Chapter 4) to run a command remotely and return the results. However, the
> > ssh server disconnects the connection after executing the command and
> > returning the result.
> > However, it doesn't happen for all SSH servers.
> > Is there any way to force the ssh server to keep alive the session after
> > executing
>
> It is normal that the session gets closed after an exec request (see the
> RFC).
> If you don't want that use a non-interactive shell ...
>
> https://api.libssh.org/stable/libssh_tutor_shell.html
>
> There is no example, but you could improve the docs once you get it
> working!
>
> You need to use ssh_channel_request_shell() and you need some protocol to
> find
> out if your command was successful or not like:
>
> ./mytool && echo SSH_OK || echo SSH_KO
>
>
> I hope this helps :-)
>
>
>         Andreas
>
> --
> Andreas Schneider                 asn@xxxxxxxxxxxxxx
> GPG-ID:     8DFF53E18F2ABC8D8F3C92237EE0FC4DCC014E3D
>
>
>

Follow-Ups:
Re: Keep alive the session after remote execution of the commandsJavad Rahimi <javad321javad@xxxxxxxxx>
References:
Re: Keep alive the session after remote execution of the commandsAndreas Schneider <asn@xxxxxxxxxxxxxx>
Archive administrator: postmaster@lists.cynapses.org