diff options
-rwxr-xr-x | vnc | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -6,10 +6,12 @@ # Parameters BASENAME="`basename $0`" SERVER="$1" +LOCALPORT="${2:-5901}" +REMOTEPORT="${3:-5901}" # Check if [ -x "$SERVER" ]; then - echo "usage: $BASENAME <server>" + echo "usage: $BASENAME <server> [localport] [remoteport]" exit 1 fi @@ -31,12 +33,12 @@ EOF # See http://www.g-loaded.eu/2006/11/24/auto-closing-ssh-tunnels/ # Optional SSH compression #ssh -C -c blowfish -f -L 5901:127.0.0.1:5901 $SERVER sleep 10 -ssh -f -L 5901:127.0.0.1:5901 $SERVER sleep 10 +ssh -f -L $LOCALPORT:127.0.0.1:$REMOTEPORT $SERVER sleep 10 # Run VNC client # Copy $SERVER:~/.vnc/passwd into $HOME/.vnc/$SERVER.passwd for passwordless login if [ -e "$HOME/.vnc/$SERVER.passwd" ]; then - vncviewer -passwd $HOME/.vnc/$SERVER.passwd localhost:5901 + vncviewer -passwd $HOME/.vnc/$SERVER.passwd localhost:$LOCALPORT else - vncviewer localhost:5901 + vncviewer localhost:$LOCALPORT fi |