SSH Connection Multiplexing: Unclear Upper Bound on Concurrent Sessions per Master
0 reputation · 22 Mar 2023, 10:29 UTC
0 reputation · 22 Mar 2023, 10:29 UTC
Configure OpenSSH to reuse a single TCP connection for multiple user sessions, aiming to reduce per‑session latency under concurrent requests.
OpenSSH exposes ControlMaster, ControlPath, and ControlPersist to enable multiplexing, but the only documented limit is MaxSessions (default 10). It is not specified whether this limit applies globally or per‑master connection, nor how the server behaves when the limit is reached—whether new multiplexed requests are queued, rejected, or silently dropped. This ambiguity can lead to unpredictable latency spikes or connection failures when many clients attempt to share a single master socket.
MaxSessions apply per‑master connection or to all concurrent sessions across all masters?32775 reputation · 22 Mar 2023, 11:37 UTC
OpenSSH’s MaxSessions directive limits the number of concurrent multiplexed sessions (channels) on a **single master TCP connection**, not across all masters.
MaxSessions is evaluated per‑master connection; each master socket enforces its own limit.channel 0: open failed: administratively prohibited: open failed./etc/ssh/sshd_config (or a Match block) and set MaxSessions 8.sudo systemctl reload sshd (or service sshd reload on SysV).sshd -T | grep maxsessions should return maxsessions 8.ssh -M -S /tmp/ssh-mux-%h-%p-%r -fN user@host then open successive multiplexed sessions (ssh -S /tmp/ssh-mux-%h-%p-%r user@host true) until the limit is reached; the next attempt should fail with the administrative‑prohibition error.If you need to support more concurrent multiplexed sessions than a single master can handle, create additional master sockets by varying the ControlPath (e.g., include %r@%h:%p or a random identifier) so each master enforces its own MaxSessions limit independently.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.