Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Session" vs "Channel" (JSch and sshd)

Tags:

ssh

jsch

sshd

I'm looking to move small files (at unknown times and in unknown quantities) from one server to another using JSch - unfortunately, I tried to open up a sessions for each transfer which quickly bombed out (as MaxSessions was I guess 10?).

Then I opened one session (per host) with JSch, and simply created a channel for each action (a single send would create a channel, put the file, closed the channel), but I encountered the same thing (when trying to do it 10 or more at a time, I would get connections refused as some channels were still closing when another request came through).

So I've looked at sshd_config and figured out that they have a MaxSessions property which would come in quite useful here - but it got me wondering, is there not a MaxChannelsPerSession property, or am I getting confused with regard to what JSch calls a "channel" and what is an actual SSH channel.

I am using the most recent version of JSch as of 20120316.

(And most importantly, should I post this in a different place on the site? It's kind of programming related, but I guess is part sysadmin as well...)

like image 441
SubSevn Avatar asked Mar 16 '12 17:03

SubSevn


People also ask

What is JSch channel?

JSch is a pure Java implementation of SSH2. JSch allows you to connect to an sshd server and use port forwarding, X11 forwarding, file transfer, etc., and you can integrate its functionality into your own Java programs.

What is the use of JSch?

JSch is the Java implementation of SSH2 that allows us to connect to an SSH server and use port forwarding, X11 forwarding, and file transfer. Also, it is licensed under the BSD style license and provides us with an easy way to establish an SSH connection with Java.


1 Answers

I'm the author of JSch.

"MaxSessions" property on sshd_config will be recognized as "MaxChannelsPerSession" on OpenSSH's sshd.

like image 183
ymnk Avatar answered Sep 22 '22 15:09

ymnk