Reverse SSH connection

Imagine that you have a host (named A) somewhere that has no publicly reachable IP address but you would like to connect it via SSH. If this host A can reach outside, then you can reverse SSH into it. Here is the scenario;

Host A ( —  INTERNET —- Host C (

On host A, run the following command;

Once you authenticate yourself, this opens a tunnel from Host C to Host A but
from port 2025 to 22. If you want to connect from Host C to Host B back you can simply run;

Can you see that as if you are connecting to localhost? but indeed connection is tunneled towards the Host A

You have a feedback?

This site uses Akismet to reduce spam. Learn how your comment data is processed.