Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a limit to how many channels can be open per session in JSch?

Tags:

jsch

Is there a limit to how many channels can be open per session in JSch ? The cannels I am trying to open are of type "ChannelShell"

I get an "com.jcraft.jsch.JSchException: channel is not opened." exception when I try to open the eleventh channel i.e. channel[10] Does this mean that I can have up to 10 channels per session?

P.S. I dont understand how to meet stackoverflow's quality standards.

like image 430
Martin Klosi Avatar asked Aug 04 '11 19:08

Martin Klosi


People also ask

What is Session in JSch?

A Session represents a connection to a SSH server. One session can contain multiple Channel s of various types, created with openChannel(java. lang. String) . A session is opened with connect() and closed with disconnect() .

What is Channel in JSch?

public abstract class Channel extends Object implements Runnable. The abstract base class for the different types of channel which may be associated with a Session . It should be considered an implementation detail that Channel implements Runnable – external code never has to invoke the run() method.

What is setKnownHosts in JSch?

public class JSch extends Object. This class serves as a central configuration point, and as a factory for Session objects configured with these settings. Use getSession to start a new Session. Use one of the addIdentity methods for public-key authentication. Use setKnownHosts to enable checking of host keys.

What is setServerAliveInterval?

setServerAliveInterval. public void setServerAliveInterval​(Integer serverAliveInterval) Sets the timeout interval (milliseconds) before a server alive message is sent, in case no message is received from the server. Parameters: serverAliveInterval - The server alive interval.


1 Answers

OpenSSH's sshd had such a restriction to allow only 10 channels simultaneously, and recent its sshd has introduced the flag 'MaxSession' to sshd_config.

Refer to "man sshd_config",

 MaxSessions
         Specifies the maximum number of open sessions permitted per net-
         work connection.  The default is 10.
like image 88
ymnk Avatar answered Oct 21 '22 04:10

ymnk