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

Re: ssh_channel_open_session only works the first time called


On 11/2/21 15:46, Jakub Jelen wrote:
Hi,
does your Cisco switch support more channels? You can try it for
example with openssh with connection multiplexing using
ControlMaster/ControlPath.

That's an interesting point. Did not know that multiplexing is possible.
But this is what I got:

First terminal
==============
tr@LinuxMint19:~/$ ssh -o ControlMaster=yes -o ControlPath=~/.ssh/control-%h_%p_%r admin@192.168.4.219
Password: ************
gwswitch1#

Second terminal
===============
tr@LinuxMint19:~/$ ssh -o ControlPath=~/.ssh/control-%h_%p_%r admin@192.168.4.219 mux_client_request_session: session request failed: Session open refused by peer
Password: ************
gwswitch1#

Output on first terminal after second terminal connects:
gwswitch1#channel 3: open failed: resource shortage:
gwswitch1#

It seems that multiplexing is not possible on Cisco switches.
But now I am a little bit confused. I thought that calling

ssh_channel_close(channel);
ssh_channel_free(channel);

closes the shell and the session in a way that I can open a new one if needed. What is the right way to open a SSH connection, open a terminal/shell, execute a few commands in it with

ssh_channel_write()
ssh_channel_read_nonblocking()

and close the shell without losing the connection?

comes from an error writing some packet. Can you step through that
part of the code for example with gdb to see what is failing where. I

I am using a compiled libssh library. For that I cannot debug the libssh code. :(

Also, the important question is which libssh version are you using? Is
it up to date?

I am using version 0.9.6.

Thorsten

Follow-Ups:
Re: ssh_channel_open_session only works the first time calledJakub Jelen <jjelen@xxxxxxxxxx>
References:
ssh_channel_open_session only works the first time calledlibssh.org_ml@xxxxxxxxxxxxxxxxxxxx
Re: ssh_channel_open_session only works the first time calledJakub Jelen <jjelen@xxxxxxxxxx>
Archive administrator: postmaster@lists.cynapses.org