Fedora 17 - VNC server setup

This guide explains how to setup a multi-user VNC server on Fedora 17

Follow up:

Many things have changed since I last delved into this back in Fedora 8.

- the service command is now replaced with systemctl

- chkconfig only controls sysv based services - not systemd.  Instead use systemctl with no arguments

/etc/sysconfig/vncservers has been replaced with /etc/systemd/system/vncserver@:1.service



1.  Install the required packages

# yum install xorg-x11-font* tigervnc-server tigervnc-server-module

2. Copy the default vnc config file to the /etc/systemd/system/ .    You will need to copy a file for each user who will be connecting to the server and assign a Display (starting at number 1)

In my case, UserA is assigned to Display 1 and UserB is assigned to Display 2

# cp /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@:1.service

# cp /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@:2.service

3. You will need to edit each of these files to configure the VNC session for each user.

# nano /etc/systemd/system/vncserver@:1.service

Find the line which starts with ExecStartPre= and concentrate on that and the next 2 lines after it.

You'll need to update all instances the <USER> variable with the actual username   e.g. UserA

Update all instances of  %i to :1 for your display number.

Make sure your ExecStart=  statement looks like this:

ExecStart=/sbin/runuser -l chris -c "/usr/bin/vncserver :1 -geometry 1280x720 -depth 16 -fp /usr/share/X11/fonts/misc"

4.   Set a VNC password for each user (max: 8 characters)

Log in as each user and execute the command vncpasswd for each account.

This will prompt for a password.

This will crfeate a .vnc folder in each user's home directory and it stores the hashed password in there.

5.  Enable the service and start it (for each instance)

# systemctl enable vncserver@:1.service

# systemctl enable vncserver@:2.service

# systemctl start vncserver@:1.service

# systemctl start vncserver@:2.service

6. netstat -lnt to check if the service is running

you will see a reference to port 5900, then sequential ports upwards from there to specify your individual user's entry points

In my case, UserA had Display 1 assigned so they connect to port 5901.   UserB had Display 2 assigned so they connect to port 5902.

NOTE: Make sure these ports are allowed through the firewall


VNC Client Connection:

In you VNC client software, it will ask for a hostname or IP address, then a Display number and password

The display number can take 2 forms:  either 5901 or 1

e.g  A.B.X.Y:5901    OR     A.B.X.Y:1

Once connected, you will be able to control a remote session in that user's account.


Be careful not to log out of the remote session as you will then need to restart the service.

Just clost the VNC client window - you may want to set a password on the screensaver for your remote session.

If you need to restart the VNC service, see below:

# systemctl restart vncserver@:1.service

# systemctl restart vncserver@:2.service



Trackback address for this post

Trackback URL (right click and copy shortcut/link location)


Comment from: Dave Matheis [Visitor]
Thanks, This has gotten me further than anything else I have found to set up VNC on fedora. I can run the client and connect to the remote server but I then just get a blank desktop, without the menu bar at the top of the screen, so I cannot do anything with it. Any ideas what would cause this? Also I get 2 critical errors when I do systemctl status: CRITICAL: gsm_manager_set_phase: assertion 'GSM_IS_... and Gtk-CRITICAL: gtk_main_quit: assertion `main_loops...

This is on a VMWARE Workstation VM.

Any direction on how to sort this out would be appreciated.



I would want to check if the service is actually spawning a desktop session once you have logged in

Check the contents of the file /etc/systemd/system/vncserver@:1.service

Make sure they look something like this

Description=Remote desktop service (VNC)
After=syslog.target network.target

# Clean any existing files in /tmp/.X11-unix environment
ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill :1 > /dev/null 2>&1 || :'
ExecStart=/sbin/runuser -l chris -c "/usr/bin/vncserver :1 -geometry 1280x720 -depth 16 -fp /usr/share/X11/fonts/misc"
ExecStop=/sbin/runuser -l chris ¨-c "/usr/bin/vncserver -kill :1"


Also, check inside the /home/user/.vnc for a file called xstartup.
This file directs the default desktop session to load i.e. gnome-session, twm, etc

Here are the contents of my xstartup - it should be generic enough for you to use


vncconfig -iconic &
OS=`uname -s`
if [ $OS = 'Linux' ]; then
if [ -e /etc/SuSE-release ]; then
export PATH
if [ -x /etc/X11/xinit/xinitrc ]; then
exec /etc/X11/xinit/xinitrc
if [ -f /etc/X11/xinit/xinitrc ]; then
exec sh /etc/X11/xinit/xinitrc
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
twm &


Hopefully this helps you!

22/12/12 @ 16:17
Comment from: miguel vergara [Visitor]
thanks. it just worked. simple and very detailed
15/02/13 @ 22:37
Comment from: Jeff Hoffman [Visitor]
This finally made it work for Fedora 18..

yum remove firewalld

update the files lines above to this:
# Clean any existing files in /tmp/.X11-unix environment
ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill :3 > /dev/null 2>&1 || :'
ExecStart=/usr/bin/vncserver :3 -geometry 1280x800
ExecStop=/usr/bin/vncserver -kill :3

04/04/13 @ 12:56

Leave a comment

Your email address will not be revealed on this site.

Your URL will be displayed.
(Line breaks become <br />)
(Name, email & website)
(Allow users to contact you through a message form (your email will not be revealed.)
What color is grass?
antispam test