| 1 | #!/bin/bash -xe |
| 2 | |
| 3 | function print_usage { |
| 4 | echo \ |
| 5 | " |
| 6 | usage: $0 PORT REMOTE_PORT user@proxy |
| 7 | script that sets up a reverse ssh tunnel, and optionally starts a VNC server as well if the START_VNC environment variable is not null |
| 8 | PORT is the port that your techy needs access to. In general, for graphical issues use 5900 and for command-line issues use 22 |
| 9 | REMOTE_PORT is the port that you'll get on the proxy server, any number over 1000 works as long as you and your techy plug in the same number |
| 10 | USER is just your username at the remote proxy machine, if left blank it is assumed to be the same as your username on your local machine |
| 11 | " |
| 12 | } |
| 13 | |
| 14 | [ -n $@ ] || print_usage |
| 15 | |
| 16 | PORT_TO_FORWARD=$1 |
| 17 | REMOTE_PORT=$2 |
| 18 | USER=${3:-$(whoami)} |
| 19 | |
| 20 | ssh -T -R $REMOTE_PORT:localhost:$PORT_TO_FORWARD $USER |