I know that on Unix Systems, you can keep an ssh connection open.
Step 1: Create a ssh configuration, for example:
Host <some.host.name>
ControlPath ~/.ssh/master-%r@%h:%p
ControlPersist yes
Step 2: Start ssh with the -M
parameter.
Is there something equivalent under Windows to reuse ssh connections? Maybe I looked at the wrong places, but I didn't find any good links on this topic.
(I tried my approach from above in a MingGW environment (using MingGW's ssh client). In real Unix system, it should have created a special socket file in ~/.ssh
, but that functionality does not seem to be supported by MingGW.)
You need to use openssh for windows, either through cygwin, or this port: http://miked.ict.rave.ac.uk/display/sshwindows/OpenSSH+for+Windows
You are talking about two different things:
Your subject indicates keeping connections open indefinitely, where my answer would be: If you are using puTTY, then you can set a keepalive in the configuration of a session: Configuration => Connection: Sending of null packets to keep session active Seconds between keepalives (0 to turn off)
Your text indicates connection sharing. No idea for puTTY with that.
Kind regards, Viktor Zacek
Bug 1278 - CYGWIN controlMaster connections don't work. describes use of ControlMaster/ControlPersist as partially implemented under Cygwin as of December, 2016, but with a qualification that it works only for remote commands and not for connections that require a pseudo terminal.
While this answer was not confirmed under Cygwin, per se, it was validated as true for MSYS2 (based on Cygwin). openssh under MSYS2 supports ControlMaster/ControlPersist connections for remote commands, but not for interactive sessions.
The following errors occur when running
ssh
without a remote command specified:With remote commands specified, the errors do not occur.