I've configured vncserver on my CentOS5 system and it now accepts remote VNC connections. I want the user to automatically be presented with the Gnome desktop upon successful VNC connection. In testing this, I tried executing startx after establishing a connection and receive the following:

Fatal server error:
PAM authentication failed, cannot start X server.
Perhaps you do not have console ownership?

How do I rectify this issue?

  • vncserver already runs a virtual desktop, starting X on connecting won't do anything. Do you mean you want VNC access to the real X desktop that's displaying on the console? – DerfK Sep 29 '11 at 22:53
  • I believe so. I installed Gnome Desktop as well as X11. What do I need to do to ensure that Gnome starts when user successfully connects via VNC? – SidC Sep 29 '11 at 23:24

You're still not very clear on whether you are running Gnome on the monitor plugged into the computer and want to access that over VNC, or if you want to run Gnome on the virtual desktop that vncserver provides.

If you want the virtual desktop, edit the ~/.vnc/xstartup file and uncomment the two lines it tells you to uncomment (remove the # from in front of the command) in order to get a "normal desktop". If gnome isn't set up as the system's default desktop, then you'll need to change the exec /etc/X11/xinit/xinitrc command to exec /usr/bin/gnome-session. Note that if your user is already running a gnome session (say, on the monitor) then you will be unable to start another gnome session. (According to this thread.)

If you want the desktop you see on the monitor to be available over vnc, then you'll need to configure the X "vnc" module included in the vnc-server centos package. There are instructions on doing so here. Note that installing it as an X module means that the VNC server is always on whenever X is running (whether a user is logged in or not) and that any user who has the password to the VNC server can connect to the computer no matter who is logged in to the computer. The alternative is to install x11vnc which uses screen grabbing to serve the display but only when you specifically run the x11vnc server. (Centos5 instructions here.)

Finally, if you really do mean that you want vncserver to serve a virtual desktop AND you want it to not start Gnome until someone connects, then the instructions also cover that here.

Whichever way you've chosen, be sure you've read the security section on that centos instructions page.

  • Sorry for the confusion. I'm using a cloud server and therefore there is no monitor plugged into it. Thus, I want to run Gnome on the virtual desktop provided by vncserver. – SidC Sep 30 '11 at 14:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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