My office has one default gateway and behind that is a local network with locally assigned IP addresses to all computers including mine.
I hold admin in my Ubuntu installed office PC and is it essential that I access the computer during weekends through SSH.
At office, I do not have a public IP but I always get the same local IP from the DHCP. I'm free to set up any software I like in my pc although I cannot set up port forwarding in the main firewall.
I get a public IP to my home computer which also runs Linux. please note I cannot install Team Viewer-like software.
How can I solve my problem?
It's easy:
[execute from office machine] Setup connection Office -> Home (as Home has public IP). This will setup reverse tunnel from your office machine to home.
ssh -CNR 19999:localhost:22 homeuser@home
[execute from home machine] Connect to your office from home. This will use tunnel from the step 1.
ssh -p 19999 officeuser@home
Please ensure, that ssh tunneling is not against your company policies, cause sometimes you can get fired for such connection schema (e.g. my employer will fire me for that).
ps. In the first step you may want to use autossh
or something like that, so your tunnel connection will be automatically restored in case of unstable network.
-N
option tells ssh do not perform actual login and it will just open tunnel and hand till disconnected with ^c or network issue — Nov 18, 2014 at 15:26