On 6/30/22 10:42, Javad Rahimi wrote:
Hello,
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
I think this depends on the server configuration. OpenSSH servers by
default allow creating more channels/sessions per connection
(MaxSessions default is 10 in sshd_config), but if you connect to other
SSH implementation or if somebody configured the server not to allow
opening more sessions/channels, then this might fail.
Please, review the server configuration, but if the server
configuration/implementation does not allow this, there is nothing else
you could do. Only run all the commands as part of the shell as
mentioned by Andreas previously.
Regards,
--
Jakub Jelen
Crypto Team, Security Engineering
Red Hat, Inc.