1

I'm using SourceTree (a Git GUI) which uses PuTTY as SSH client. I need to push some code into a repository for which I need to tunnel through SSH to do so. The trouble is, the repository and SSH authentication server are on separate servers. Hence, I need to login to one server and then push to another one.

I was given the following config file but I don't know how to use it with PuTTY:

Host login
HostName login.nets.*******.**

Host zeus
HostName zeus.nets.*******.**
ProxyCommand ssh login nc %h %p 2> /dev/null
#ProxyCommand ssh login -W %h:%p
ForwardAgent yes
IdentityFile ~/.ssh/id_rsa

closed as off-topic by Adi, Xander, TildalWave, Iszi, AJ Henderson Apr 23 '14 at 16:39

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question does not appear to be about Information security within the scope defined in the help center." – Adi, Xander, TildalWave, Iszi, AJ Henderson
If this question can be reworded to fit the rules in the help center, please edit the question.

5

PuTTY does not store its configuration in a file. However, PuTTY can use a "proxy command", as described here.

In your case, the example config file shows that there should be two encapsulated SSH connections:

  • The outer SSH is done to host login.nets.***. When that connection is done, the command nc is run on that host: it basically forwards data bytes to port 22 on the inner host zeus.nets.***.

  • The inner SSH is done again from your machine, to host zeus.nets.***, with all data bytes sent through the outer SSH.

In the ProxyCommand option, the ssh login part is the invocation of the outer SSH when the user (or your GUI application) tries to connect to "zeus". It is not obvious whether PuTTY itself can be invoked that way: there is a command line but you also need the "inner PuTTY" to forward all its bytes to the "outer PuTTY", and it is unclear whether that "outer PuTTY" will accept the bytes on its "standard input" (Windows is not Unix, and, moreover, PuTTY does not expect to run in a terminal or on raw bytes; it more tries to open its own window).

Possible alternatives:

  • Try to use port forwarding. In that case, you manually start a PuTTY to login.nets.***, with a port forwarding from local port 5000 (that's an example) to remote host zeus.nets.*** and remote port 22. Then you configure your GUI to talk (with PuTTY) to localhost on port 5000. When the GUI launches the PuTTY which connects to localhost on port 5000, the other PuTTY (the one you started manually) forwards the bytes to host login.nets.*** with instructions to open a connection from that host to zeus.nets.*** on port 22.

    This may or may not work, depending on the configuration of the SSH server on login.nets.*** (support for such tunnels can be enabled or disabled by the sysadmin).

  • Use a more Unix-like SSH client, e.g. through Cygwin. Since this is the usual OpenSSH, it will be able to read and use the provided SSH configuration file, and do the nested invocation. Of course, there is no guarantee that your "SourceTree" application can be configured to use such a SSH client.

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