03 May 2008

ssh tunnels

Say you have machineX which can access an machineZ:8888 and machineY which cant access machineZ:8888. Yet you want to access machineZ:8888 from machineY. You can run the following on machineY:

userA@machineY> ssh -N -f -L 8888:machineZ:8888 userA@machineX

Now, on machineY you can connect to localhost:8888 and automatically be tunnelled to machineZ via machineX.