VNC- Virtual Network Computing
Posted by hsukumar on 08/04/2009
To configure vncserver as a service on your system, add yourself in following config file.
[harry@beans.com]$ sudo vi /etc/sysconfig/vncservers
# The VNCSERVERS variable is a list of display:user pairs.
#
# Uncomment the line below to start a VNC server on display :1
# as my 'myusername' (adjust this to your own). You will also
# need to set a VNC password; run 'man vncpasswd' to see how
# to do that.
#
# DO NOT RUN THIS SERVICE if your local area network is
# untrusted! For a secure way of using VNC, see
# URL:http://www.uk.research.att.com/vnc/sshvnc.html
# VNCSERVERS="1:myusername"
VNCSERVERS="1:harry"
Before starting vncserver as a service, let’s create a vnc password with vncpasswd command.
Notice it creates a hidden directory .vnc under your home account with file passwd which contains your vnc password.
[tchung@tchung101 tchung]$ vncpasswd
Password:
Verify:
[beans@harry]$ ls -d .vnc
[beans@harry]$ ls .vnc
passwd
[beans@harry]$
Now let’s start vncserver as a service.
[beans@harry.com]$ sudo /sbin/service vncserver start or service vncserver start
Starting VNC server: 1:tchung [ OK ]
[tchung@tchung101 tchung]$
Take a look at the contents of .vnc directory now. You should have something similiar to following.
[tchung@tchung101 tchung]$ cd .vnc
[tchung@tchung101 .vnc]$ ls
passwd tchung101:1.log tchung101:1.pid xstartup
[tchung@tchung101 .vnc]$ If you edit the script called xstartup, you will notice following comment in red.
Uncomment those two lines in red as shown below!!! Otherwise, you will get nothing but grey screen. #!/bin/sh
# Uncomment the following two lines for normal desktop:
unset SESSION_MANAGER
exec /etc/X11/xinit/xinitrc
#!/bin/sh
# vncconfig -iconic &
# 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
xterm -geometry 80×24+10+10 -ls -title “$VNCDESKTOP Desktop” &
twm &
I have add to add these lines just because my fedora box refused to start x without the following lines 3, please remember to delete &twm if you are going to add the below lines
gnome-session &
gnome-wm &
gnome-panel &