Home » Tutorials » Reverse SSH connection

Reverse SSH connection

So I have installed Linux for a friend of mine, which he was happy with. However as he’s not the most tech savvy as soon as he encountered an issue (installing flash) he straight away contacted me about it. Trying to explain to him how to do it was like talking to a monkey about real estate, same thing goes to attempting to get him to open an ssh port on his firewall so I could log in.

After a little brain storming I figured that since SSH supports Dynamic port forwarding it definitely have a solution of some sort for me. After reading the ssh manual page the -R option sounded like something I was looking for.

Quick test between my local machine and my cloud server resulted in a success.

Here’s how:

Lets call my PC Machine A and his Machine B.

I created him a user on my system and got him got him to run this on his box:

$ ssh -R 2222:localhost:22 [email protected]

This connected him to my machine A and forwarded the local 2222 port to the port 22 on his machine B.

Then it was just a matter of me running the following:

$ ssh localhost -p 2222

There you go, access to his machine without pulling my hair trying to explain stuff to him! win!

Posted in Tutorials, Useful and tagged as ,

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload the CAPTCHA.