Is there any way to create a dependence between two sessions in PuTTY? I would like to have a session ("session-client") automatically call another session ("session-tunnel") before opening the connection. Currently, the two connections work as intended on their own (i.e., if I first open "session-tunnel" and then open "session-client"), but I would like some mechanism for calling only "session-client" and automatically having "session-tunnel" open first.

I have read up on the proxy function, but can't seem to find any way to use "session-tunnel" in this role. This is almost what I want, but I don't want it to reroute to standard in/out; I just want it to run the proxy command before opening a regular ssh session.

The purpose of opening the connection this way is that I want to run a plain ssh-tunnel (not vpn) with passwordless ssh (authorized-keys only) with different user names on the target of "session-client" and "session-tunnel". I would like to be able to access this compound connection through a single PuTTY session handle so I can use that session handle in Tortoise SVN.

My sessions are configured with different user names for the tunnel and for the svn server, along with different keyfiles. A screenshot of the relevant screens follows (note port numbers and IP addresses have been changed.)

Screenshots of working tunnel settings and failing proxy settings

  • When I use a proxy command to open the connection, the tunnel is refused, and I don't understanding why. When I open the connection through "session-tunnel" followed by "session-client", the connection is successful. The proxy command does not seem to be working in the same way as the tunnel session. My current understanding is that a tunnel doesn't "reroute to standard input and standard output"; the tunnel server doesn't support any commands, so only the forwarding connection is allowed; my understanding is that forwarding standard in/out will not work. – KDN May 27 '19 at 22:57
  • From looking at the PuTTY logs, it appears that the client session (which attempts to connect to localhost) is attempting is connection prior to the execution of the proxy command (i.e., it is attempting to connect to local "localhost" instead of the remote "localhost"). This is undoubtedly an error in my understanding of PuTTY's proxy command configuration, but I have been unable to determine what I can do to correct it. – KDN May 27 '19 at 23:02
  • What "localhost'? There should be no "localhost" involved. "localhost" is used with port forwarding. There's no local port forwarded here. There's actually input/output redirection that replaces the port forwarding. – Martin Prikryl May 28 '19 at 5:19
  • Localhost is involved because the server that "tunnel-session" connects to is hosting a reverse port-forwarded client that is the target of "client-session". I'd like to keep the indirection because it requires two keys to connect and it doesn't directly open the reverse-forwarded port to the internet; only clients connected to the tunnel host are able to access the (subversion) server. I think that the in/out redirection is not working because I have authorized-keys configured to set a default command, disallow pty and all manner of forwarding, except for a single "permitopen" target. – KDN May 28 '19 at 10:30
  • I do not follow. I'm afraid we talk about two different things --- Would you post a screenshot of your working setup with two PuTTY sessions and how do you use them in Tortoise SVN? – Martin Prikryl May 28 '19 at 10:41

In PuTTY, you can use plink for "local proxy command". This way, you can implement an SSH tunnel.

For details, see OpenSSH ProxyCommand equivalent in PuTTY.

You can then save this proxy configuration as PuTTY stored session.

From "but I don't want it to reroute to standard in/out", it bit sounds, like you are aware of this option and you do not want it. But I do not understand why.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.