How to connect to a box behind a router _without_ port forwarding?

Asked by ak

A remote box running Ubuntu sits behind a router. I have to maintain the Ubuntu box, and have permission, and haven't shipped it yet so I can set it up any way I need, but the router is not in my control, and will take several months for the bureaucracy to approve port forwarding. The remote box has access to the Internet (through the router), so I could easily visit the site and ssh into my office (though that would be pointless; the purpose here is to permit maintainance of the remote box), but the site is a one-hour flight away. How to establish a connection to the Ubuntu box from my office?

I cannot see anyway except for the remote box to initiate the connection. If so, how can it hand control of the connection to me? For example, I could have the remote box ssh to me each morning at 7am, but I would still need to somehow 'flip' the session so that I in my office was seeing the remote box, rather than it seeing me. Crackers must be doing this all the time, but I can't see a solution in 'Hacking Linux Exposed' or online searches of cracking tools.

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
ak
Solved:
Last query:
Last reply:
Revision history for this message
Thomas Butter (tbutter) said :
#1

You could use ssh port forwarding. On your remote box start ssh which forwards a port from the office computer.

ssh -R2222:localhost:22 user@office

Then you can connect to port 2222 on your office computer to get to the ssh port on you remote computer.

ssh -p 2222 localhost

Revision history for this message
ak (akujbida) said :
#2

Fantastic! Tried it out, works superbly. The best solution is usually the simplest one, preferably with established tools. Thanks very much, Thomas.