Reverse SSH Tunnel: Difference between revisions
From Leo's Notes
This page was last edited on 1 September 2019, at 05:08.
Created page with "Suppose you are inside a network that has no public IP address. If you are working on machineA, and you need to SSH in from outside the network, say from machineB, run the fol..." |
m Text replacement - "Category:Linux" to "Category:Linux{{Navbox Linux}}" |
||
| Line 9: | Line 9: | ||
The first command creates a SSH tunnel which opens port 22222 on machineB that tunnels to machineA:22. You may extend this by replacing localhost with another host on the internal network in order to SSH in remotely to another host. | The first command creates a SSH tunnel which opens port 22222 on machineB that tunnels to machineA:22. You may extend this by replacing localhost with another host on the internal network in order to SSH in remotely to another host. | ||
[[Category:Linux]] | [[Category:Linux]]{{Navbox Linux}} | ||
Revision as of 05:08, 1 September 2019
Suppose you are inside a network that has no public IP address. If you are working on machineA, and you need to SSH in from outside the network, say from machineB, run the following on machineA:
machineA$ ssh -R 22222:localhost:22 user@machineB
On machineB, you can now SSH to machineA by running:
machineB$ ssh user@localhost -p 22222
The first command creates a SSH tunnel which opens port 22222 on machineB that tunnels to machineA:22. You may extend this by replacing localhost with another host on the internal network in order to SSH in remotely to another host.