VNC allows you to create an additional Remote Desktop session on your system. This can be thought of as an additional but separate Desktop which can be accessed using a VNC viewer client (example). Most users do not have a need to create an extra XWindows session and would prefer to simply share their current Windows desktop instead.

To share the desktop, simply use the Remote desktop settings in the Control Panel to configure a VNC Desktop share. If you prefer to setup an additional display, follow the directions in this document.


A VNC Server can be started from the command line manually with the vncserver command or Xvnc command. This allows users to connect to a machine to obtain a "remote desktop" of that machine. VNC creates a secondary display that does not interfere with the user logged into the system. If users want to setup a "remote desktop" in order to share a users primary display. They should use the Remote Desktop (vino-preferences) option in the Control panel.

The goal of this document is to setup vnc on a host machine such that a user can simply type: vncserver and have a VNC session created for users to connect to. This is useful for remote support and working remotely.

Setting up and testing a Session

  1. Optionally: turn off firewall for testing purposes
    su -
    service iptables stop
  2. Optionally: Create a user account if not done so already. (replace 'vncuser' with your intended userid)
    (i.e. Useradd -G users,wheel vncuser; passwd vncuser )
  3. Switch to that user by issuing the following command:
    (in other words, replace the word 'vncuser' with your login id)
    su vncuser -
  4. Optionally: reset the users .vnc profile by deleting the .vnc directory:
    rm -Rf /$HOME/.vnc
  5. Now run vnc server command:
    $ vncserver -geometry 1024x768 -depth 16
  6. When asked enter in the VNC password
    (Note, you can change it later by typing vncpasswd)
    $ vncserver
    You will require a password to access your desktops.

    Password: ********
    Verify: ********

    New desktop is duvel.fishkill.ibm.com:1
    Creating default startup script /home/quickm/.vnc/xstartup
    Starting applications specified in /home/quickm/.vnc/xstartup
    Log file is /home/quickm/.vnc/duvel.fishkill.ibm.com:1.log
  7. Take note of the address (i.e. duvel.fishkill.ibm.com:1 )
  8. Now that we know it starts and the configuration has run
    Stop the VNC Session with the following:
    su -
    killall Xvnc

Configuring the xstartup Parameters

  1. use VI or gedit to edit the user's xstartup profile:
    gedit /home/vncuser/.vnc/xstartup &
  2. You should see settings in the default xstartup.
  3. Alter the file such that the following fields are at the top:
    • #!/bin/sh
    • vncconfig -iconic &
    • exec /etc/X11/xinit/xinitrc

    • Example:
      Click here to view example_vnc_config.txt
    • #!/bin/sh
      # ----------------------------------------------------------------
      # /home/vncuser/.vnc/xstartup
      # ----------------------------------------------------------------
      # Uncomment the following two lines for normal desktop:

      vncconfig -iconic &
      exec /etc/X11/xinit/xinitrc

      # take this section out if you want to use GNOME instead of TWM
      # [ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
      # xsetroot -solid grey
      # vncconfig -iconic &
      # xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
      # twm &
      # ----------------------------------------------------------------
  4. Note, users will have to enable ports other than 5900,5901 through the iptables firewall.

Further Testing the VNC Session

  1. Start the service again with the vncserver command. (depth means color bitrate 2^16 colors, geometry is the session screen size)
    vncserver -geometry 1024x768 -depth 16

    (users could just type vncserver if they wanted, there are a lot of options available)

    In windows download TightVNC
    and connect to host:display (i.e. x.x.x.x:1)

    In Linux, use vncviewer or krdc
    vncviewer x.x.x.x:1

VNC As Server Service

If you want VNC session to setup on boot, please use the following link:


deepak singh said... @ November 26, 2016 at 1:11 AM

Thanks for providing this informative information you may also refer.

Post a Comment