/ Published in: Bash
Need to forward a port through SSH, but you don't have shell access to the box? If you have access to another box that can get to the desired port, use this script. You need socat (http://www.dest-unreach.org/socat/).
./script-name 10000 other-host 10001
./script-name 10000 other-host 10001
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
#!/bin/sh LOCALPORT=$1 REMOTEHOST=$2 REMOTEPORT=$3 socat -d -d -lmlocal2 \ TCP4-LISTEN:${LOCALPORT},fork,range=127.0.0.1/0,reuseaddr \ TCP4:${REMOTEHOST}:${REMOTEPORT}