How to install and configure tightvncserver in Ubuntu
If you simply install vncserver in Ubuntu and do not edit xstartup file, on remotel vnc access it will not show desktop menu.
In this tutorial we will learn how to install and configure vncserver in Ubuntu and also get desktop menu on remote access.
The practical was done in Ubuntu 12.04 and 12.10.
Follow these steps:
(1) login with username in Ubuntu
(2) Install tightvncserver package
sudo apt-get install tightvncserver
(2) After installation run vncpasswd command to set the password of VNC server. And be careful it will ask you “Would you like to enter a view-only password”, here you have to type n
Using password file /home/sapplican/.vnc/passwd
Would you like to enter a view-only password (y/n)? n
(3) Now we will take the backup of xstartup file (taking backup is good practice).
sharad@mypc:~/.vnc$ cd ~/.vnc
sharad@mypc:~/.vnc$cp -p xstartup xstartup.orig
(4) Now edit xstartup file and paste the given below code .(here,I am using vi editor)
sharad@mypc:~/.vnc$ vi xstartup
# Change “GNOME” to “KDE” for a KDE desktop, or “” for a generic desktop
#Uncommment this line if using Gnome and your keyboard mappings are incorrect.
# Load X resources (if any)
if [ -e “$HOME/.Xresources” ]
# Try a GNOME session, or fall back to KDE
if [ “GNOME” = “$MODE” ]
if which gnome-session >/dev/null
gnome-session –session=ubuntu-2d &
# Try a KDE session, or fall back to generic
if [ “KDE” = “$MODE” ]
if which startkde >/dev/null
# Run a generic session
if [ -z “$MODE” ]
xsetroot -solid “#DAB082”
x-terminal-emulator -geometry “80×24+10+10” -ls -title “$VNCDESKTOP Desktop” &
Save and exit by pressing key , esc :wq enter
(4) Now run the vncserver by using following command
New ‘X’ desktop is mypc:1
Creating default startup script /home/sharad/.vnc/xstartup
Starting applications specified in /home/sharad/.vnc/xstartup
Log file is /home/sharad/.vnc/mypc:1.log
Note : mypc:1 states that from remote access you have to use DISPLAY :1 and here mypc is my machine host name
Now from remote PC with the help of vnc client access the Ubuntu vnc server.
In Linux I use vncviewer.hence command is
To kill the vncserver process
vncserver -kill :DISPLAY_Number
vncserver -kill :1