Table of Contents

Using VNC Over SSH

Setting it up for the first time

[adam@host ~]$ vncserver

New 'host.remotemachine.co.uk:1 (adam)' desktop is host.remotemachine.co.uk:1

Starting applications specified in /home/adam/.vnc/xstartup
Log file is /home/adam/.vnc/host.remotemachine.co.uk:1.log

(Note, if another VNC session is already running on the target machine, your session might :2, :3 or :x, where x is the number of your session as shown above).

vncserver -kill :1

where :1 is your session ID.

gnome-session &

at the bottom. Now log out.

Of course the Gnome Desktop environment needs to be installed for this to work.

Using VNC over SSH for real

Now that all the background stuff is done, you can use it for real.

[adam@localhost ~]$   ssh -C -L 5901:127.0.0.1:5901 <username>@<remotemachine>

(Note, if another VNC session is already running on the target machine, then the second 5901 needs to be 590x, where x is the number of your session as shown in the first section).

This creates a port redirection from the VNC port on your local machine to the VNC port on the remote machine, using SSH as an encrypted tunnel and gives you an SSH shell. Ignore the SSH shell for now, or use it as you need, but don't log out of it until you're finished with your VNC connection.