Forward SSH traffic through a middle machine
Problem
SSH tunneling is very confusing to me. I am wondering if I can do this in Linux. I have 3 machines.. So I can SSH from A -> B and from B -> C, but not from A -> C. Is there a way to setup an SSH tunnel from A through B, so when I run other SSH commands it they just work from my local machine A? I am basically trying to clone a git repo from work to home (and I cannot install git on machine B). Also, once setup.. How would I unset it as well?
Error Output
A. My local machine at home. B. Machine at work that I can SSH into (middle man). C. My desktop at work that I can only SSH into from machine B.
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Fix for: Forward SSH traffic through a middle machine
Place this in your file on hostA (see man 5 ssh_config for details): Now the following command will automatically tunnel through hostB You may like to add options like and to speed things up, since wrapping inside is computationally more expensive and the extra effort and the wrapper doesn't need to be as secure when it's tunneling already-encrypted traffic. If you are using OpenSSH earlier than 5.3, the option is not available. In this case you can implement the above using netcat ( ):
Awaiting Verification
Be the first to verify this fix
Sign in to verify this fix