Here are the steps needed to attached to the remote session:
1. Start up VNC
vncserver -geometry 1024x768 :1
First time you run vncserver it will prompt you for an access password which you will use to connect to the remote login window and is stored locally in your home folder on the vnchost.
2. Establish an ssh port forward connection to vnchost
ssh -L 5901:localhost:5901 -N -T firstname.lastname@example.org
3. Start up a VNC client such as RealVNC on your local machine.
4. Make a connection to your localhost port that is tunneled to vnchost (via ssh on step 2)
It will then prompt you for the password that you set in step 1.
Resolution can be configured in the VNC client as well as the -geometry option when you start VNC for the size of the window.
kill the vnc session on the server you can use the following commands:
- vncserver -list
- vncserver -kill :1