Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I know this question has been asked here previously [ref1] [ref2] also here but so far I have been unsuccessful in my attempts. Can anyone provide a detailed guide on how to go about achieving this?

Basically what I need is I shoud be able to view the login screen through VNC Viewer. Currently someone has to first obtain the console through OVM, login and only then is it possible to remote through VNC Viewer. Once a user logs out, it's not possible to obtain remote through VNC.

  • OS: Oracle Linux 5
  • VNC rpm : vnc-server-4.1.2-14.el5_6.6


Ok so I followed everything listed here and here:

  • Logged in to the server through PuTTY using root (because that's the acount I need to use for logging in through VNC).
  • Ran vncpasswd and set the VNC login password.
  • Saved the script given in the 1st link as /etc/init.d/vncserver after changing the following parameters:
    • USER="root"
    • DISPLAY="1"
  • Did chmod +x /etc/init.d/vncserver.
  • Did chkconfig --level 2345 vncserver on.
  • Did vi /root/.vnc/xstartup and uncommented the lines:
    sh unset SESSION_MANAGER exec /etc/X11/xinit/xinitrc and changed last line from twm & to startx & (since I'm using GNOME).
  • Restarted the server.

What happens now is vnc server is listening on two ports 5900 (display 0) and 5901 (display 1) and I can successfully remote to the server through VNC Viewer without actually logging in to the server (it bypasses the lock screen). However, connections on display 0 do not prompt for password which is a cause of concern.
After some research I figured out that securely logging in to the native X-Server on display 0 is a topic in itself.
@slm's answer below and this article highlight the process.
However few things are still unclear to me:

  • The directory /usr/lib/xorg/ doesn't exist. Without this the module libvnc.so is unavailable. Am I using the wrong rpm?
  • If I follow this method do I have to undo everything I have done till now?
share|improve this question

2 Answers 2

Instead of running vnc-server on the server itself, you should connect (using VNC) to the OVM directly via the settings of your VirtualMachine: Settings → Display → Remote Display.

On that TAB enable the server (make sure you mark the port number you select), that is a VNC server and you can connect with your normal client.

share|improve this answer

To add to @Timo's answer there sounds like there are 3 ways to setup VNC access.

  1. At the user level (that's what you're using now)
  2. At the system level
  3. At the Host level (when running inside of a VM) - this is Timo's suggestion

NOTE: This tutorial shows how to do #1, it's titled: How to install VNC server on CentOS 6.

If you think for a second #3 is actually just another form of #1 & #2, depending on where you provide access to the desktop. At the user level (#1) or at the system level, (#2).

So I think what you want is actually #2. To get this type of setup working there are basically 2 methods that I'm aware of.


You can install the package x11vnc and then use this to gain access to the current X11 session on a remote system. It's generally in most of the Red Hat based distro repos so I won't cover installation, but once installed you'd ssh into a system that you want to access the console display (:0.0), and manually run it like so:

$ x11vnc -nopw -display :0.0

There are methods for making this more permanent so that it just runs as part of the session. One such method is discussed in this blog post, titled: x11vnc on CentOS5 with GDM.

X11 + vnc

The second method is to install a module/driver into X11 so that you can connect to any running X11 desktop. The one I'm familiar with is called vnc. This driver needs to be installed into the host system's X setup so that you can access the system's login manager. I'm not sure what it is on Oracle (most likely it's GDM - GNOME Display Manager) since it derives from RHEL.

The good news is that if you'e installed the package vnc-server you already have the X11 driver installed. Simply add this to your host system's X11 setup.

First you'll need to add this line to your xorg.conf's Module section:

# /etc/X11/xorg.conf
Section "Module"
  Load "vnc"

Next you'll need to add several lines to this same files Screen section:

Option "SecurityTypes" "VncAuth"
Option "UserPasswdVerifier" "VncAuth"
Option "PasswordFile" "/root/.vnc/passwd"

Last setup a password for this connection, using the tool vncpasswd, then restart X.


share|improve this answer
Hi...would you please see my updates. –  Gh0sT Jan 19 at 14:54
@Gh0sT - for starters you could just disable vncserver the service. chkconfig --level 2345 vncserver off. Then either reboot or stop it if it's started. /etc/init.d/vncserver stop. –  slm Jan 19 at 15:26
@Gh0sT - Try the command yum search libvnc.so to track it down. –  slm Jan 19 at 15:40

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.