Running vncserver on Fedora Core 10 with gdm

Fedora Core 10 introduces several new features, and as with all new releases, several new frustrations. In this how-to, I cover the steps needed to get vncserver up and running, so you can connect to your GNOME-based desktop.

First, Core 10 is more secure out of the box than any prior version of the Fedora operating system. How secure? It installs both iptables and SELinux by default, and it does not give you the option not to install them or turn them off initially. If you are unfamiliar with these, especially SELinux, you should read up on them. It has been ten years since I last worked with SELinux, so I need to get back to the books...er...wikis.

Second, vncserver does not install by default, nor do the twm or xterm applications that the default configuration of vncserver uses.

So, first, install the package(s). I did a simple yum install vncserver xterm twm.

Then, run vncserver (for the initial connection, I always take the defaults just to make sure it installed correctly):


[admin@core ~]$ vncserver

You will require a password to access your desktops.

Password:
Verify:
xauth: creating new authority file /home/admin/.Xauthority

New 'core.lab.foo.bar:1 (admin)' desktop is core.lab.foo.bar:1

Creating default startup script /home/admin/.vnc/xstartup
Starting applications specified in /home/admin/.vnc/xstartup
Log file is /home/admin/.vnc/core.lab.foo.bar:1.log

If you look in the .vnc directory, you'll find the xstartup script. In my case, it contains the following:


[admin@core .vnc]$ cat xstartup
#!/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 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
twm &

Fire up your VNC viewer (I use Real VNC on my Windows machines) and…oops, cannot connect—remember that point about the firewalls? You need to add the ports to your iptables:

iptables -A INPUT -p tcp --destination-port 5901 --source x.x.x.x/xx -j ACCEPT

(where the xxx.xxx.xxx.xxx/xx is the CIDR address range to allow, so 192.168.0.0/24, for example). Now I can connect, but the twm is not the most enlightening window manager in the toolbox, especially since I spent time installing all those really cool widgets and games into GNOME (and KDE, your choice—I use both equally well).

In the old days, it was a simple matter of commenting out the xterm and twm & and replacing them with gnome-sessions & (or gdm &, more recently). If you do that, well, you get some interesting errors:


[admin@core .vnc]$ cat core.lab.foo.bar:1.log

Xvnc Free Edition 4.1.3
Copyright (C) 2002-2008 RealVNC Ltd.
See http://www.realvnc.com for information on VNC.
Underlying X server release 10503000,

Wed Feb 25 08:52:53 2009
vncext: VNC extension running!
vncext: Listening for VNC connections on port 5901
vncext: created VNC server for screen 0

** (gdm-binary:3164): WARNING **: Failed to acquire org.gnome.DisplayManager: Connection ":1.47" is not allowed to own the service "org.gnome.DisplayManager" due to security policies in the configuration file

** (gdm-binary:3164): WARNING **: Could not acquire name; bailing out

And, if you connect, you get a lovely gray screen and the xterm window—not exactly what you were expecting.

Now, perhaps I have been setting it up wrong all these years, but if you follow the directions in xstartup and uncomment the lines for normal desktop:


[admin@core .vnc]$ cat xstartup
#!/bin/sh

vncconfig -iconic &
# Uncomment the following two lines for normal desktop:
unset SESSION_MANAGER #<-- uncomment
exec /etc/X11/xinit/xinitrc #<-- uncomment

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
#twm &

you are up and running in no time (although you still might get a few X-related display errors in the log files).

Load Disqus comments

Community Events

-
Park City, UT, USA
-
New Orleans, LA, USA
-
Copenhagen, Denmark
-
Austin, TX, USA
-
Austin, TX, USA