4ColorGrafix Logo

SSH Tunnel

In the terminal, type the following:

touch worktunnel; chmod +x worktunnel; pico worktunnel

Copy the code below into the open worktunnel file.

#!/bin/bash

# Adapted from the blog "And now it’s all this"
# http://www.leancrew.com/all-this/2008/02/leopard-screen-sharing-over-the-internet/

# Usage: worktunnel localport remoteport user@vncserver

if [ $# = 3 ] ; then
        ssh -L $1:127.0.0.1:$2 -N $3
fi

if [ $# = 4 ]; then
        ssh -L $1:127.0.0.1:$2 -N $3 -p $4
fi

if [ $# -lt 3 ] || [ $# -gt 4 ]; then
        echo "   Usage: worktunnel localport remoteport user@vncserver"
        echo "          worktunnel localport remoteport user@vncserver sshport"
fi

Save the file with CTRL X.

Author: Webmaster K