Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

To ssh onto a box behind some firewall I can do the following

home$ ssh me@ssh-server
ssh-server$ ssh me@box-behind-firewall
box-behind-firewall$

So that I can do things like use git repos etc on box-behind-firewall from outside the network, I want to combine these into a single uri, e.g. something like

ssh://me@ssh-server/;ssh://me@box-behind-firewall/some/path

Is this possible, and how's it done?

share|improve this question

3 Answers 3

You probably want to use port forwarding. Connect the the first machine using

ssh -L2222:box-behind-firewall:22 me@ssh-server

While that connection is active, you can connect to the second machine using

ssh -p 2222 me@localhost

from you local machine or access git repositories on the server using

ssh://me@localhost:2222/foo/bar/baz

as URI.

share|improve this answer

This is not possible the way you want. You would need to execute some command after logging in which ssh-URI-scheme does not support - I guess due to security concerns.

If you could run a command, you could directly do an ssh to the next server while connecting.

But you can do it with some workaround. This line's from man sshd

8. If ~/.ssh/rc exists, runs it[...]

You could just add the ssh-command to the next server (or firewall/router) here. You just need to find some way to distinguish if you want to connect the "normal" way or want to be forwarded to the router - maybe you're able to just add an user on the first server which only has the purpose to forward you to the next server?

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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