As VNC is not a secure way to connect to your linux server, you can run VNC over an SSH connection, here is how
First install your vnc server
- For Fedora and CentOS
yum install vnc vnc-server
- For Debian and Ubuntu
apt-get install vncserver
Configure your VNC server
- Run this command, this will start your vncserver running in "possition" 20, with 8 bits of colour and a screen of 1024x768
vncserver :20 -depth 8 -geometry 1024x768
- Stop the server use this other command
vncserver -kill :20
- Edit the applications file, to have your GNOME or KDE running when you connect to the PC using VNC
** Only for Fedora and CentOS **
vi ~/.vnc/xstartup
- Here be sure you have a content like this
# Uncomment the following two lines for normal desktop: unset SESSION_MANAGER exec /etc/X11/xinit/xinitrc [ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup [ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources xsetroot -solid grey vncconfig -iconic & xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" & #twm & gnome-session &
- Open VNCViewer on your windows and point to your localhost:20
- You should see something like this.
Special Thanks to Guy Boisvert and Theo Band










Thank you very much for this article.... it worked straight away!
Hi guys, this works for me.
I had to bear this in mind though;
You DONT need a X Server on the remote linux box. VNCServer acts like a XServer.
5920 is the port that vncserver listens on - see the putty screenshot
localhost:20 is from "vncserver :20"
follow the instructions exactly, use port 20 etc... and it will work.
I can confirm that you DONT nedd to open port 5920 on the server for inbound traffic - this is specifically why this solution rules
kind regards,
stu
Thanks!