Go2Linux | Linux Operating System

A site dedicated to: Linux Operating System

Secure VNC using SSH

Date: 2007-02-05 00:00:00 -0400

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 &

Configure Putty on Windows

  • 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

If you liked this article please share it.

powered by TinyLetter

If you want to contact me in any other way, please use the contact page.