On Saturday 03 June 2006 03:04 pm, Jordan Peacock wrote:
> This is how I got it running, after setting up the ssh and vncserver
> install stuffs.
>
> 1. ssh username at IP -L 5901:127.0.0.1:5901
> 2. From server: vncserver :2 -geometry 800x600 -depth 16 -name NAME
> 3. From client: vncviewer -via username at IP localhost:2
>
> Thank you Jeff, Doug, Doug's friend and everyone else who (through
> mailing lists, chat or at the Installfest) have made this possible.
> Hope it helps!
>
>                              -jordan

You might consider -N and -f as options to your SSH client connection. This 
will connection your ssh session but not start a shell or issue any commands 
and also put your ssh session in the background so you can close your 
terminal or log off or whatever and the session/tunnel will still be active. 

On the other hand, I will also sometimes establish a regular foreground ssh 
session/tunnel and initiate my program thru the tunnel then type exit in the 
ssh session so that when I terminate my tunneled application (VNC or 
whatever) the ssh session exits automatically and I am not left with an open 
tunnel.

Another option from the man page of the ssh client

$ ssh -f -L 1234:localhost:6667 server.example.com sleep 10
$ irc -c '#users' -p 1234 pinky 127.0.0.1

The -f option backgrounds ssh and the remote command ``sleep 10'' is
specified to allow an amount of time (10 seconds, in the example) to
start the service which is to be tunnelled.  If no connections are made
within the time specified, ssh will exit.