setting up vncserver on Fedora 16

Updated to reflect /etc/systemd, thanks for all the helpful comments.

The change to systemd from SysVinit caused a bit of an issue for vncserver configuration. In the past I would edit


, with systemd the process is quite different.

For our example I will setup vncserver to have display :3 running at a resolution of 1600×900. If you want a different number simply replace it with the number of choice.

sudo yum install tigervnc-server
sudo cp /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@:3.service

Next you will need to edit the service file with the username you want vncserver to run under and any vnc options you want.

sudo vi /etc/systemd/system/vncserver@:3.service

The file will look something like this when you open it:

# comment redacted
Description=Remote desktop service (VNC)

ExecStart=/sbin/runuser -l  -c "/usr/bin/vncserver %i"
ExecStop=/sbin/runuser -l  -c "/usr/bin/vncserver -kill %i"


Change <USER> with the username you want to run vncserver under. For our case let’s use kdr.

Next add the vnc options you want after the %i. Since we want it to run at a resolution of 1600×900 we will add -geometry 1600x900.

ExecStart=/sbin/runuser -l kdr -c "/usr/bin/vncserver %i -geometry 1600x900"
ExecStop=/sbin/runuser -l kdr -c "/usr/bin/vncserver -kill %i"

Save the file and enable the service:

sudo systemctl enable vncserver@:3.service

Now configure the password you want to use to connect to vnc. Run this
as the user you setup in the *.service file above i.e. kdr.


We now have vncserver setup with a username and a password, and enabled in the system. Two more things to check. First thing is verify you have the port open. The vnc display number will map to 5900 series of ports. Since we chose 3 vncserver will listen on port 5903. If you choose 1, it’ll be 5901, etc.

Let’s see if iptables is configured to listen to this port:

sudo iptables --list | grep 5903

Nope, let’s update iptables:

sudo vi /etc/sysconfig/iptables

Add this to the file:

-A INPUT -p tcp -m state --state NEW -m tcp --dport 5903 -j ACCEPT

Save the file, then restart iptables and verify that the port is active.

sudo systemctl restart iptables.service

sudo iptables --list | grep 5903
ACCEPT     tcp  --  anywhere             anywhere             state NEW tcp dpt:5903

Ok FINALLY we can start up vncserver.

sudo systemctl start vncserver@:3.service

Test it out by connecting with vncviewer
Enter the password you used for vncpasswd.



10 thoughts on “setting up vncserver on Fedora 16

  1. Hi there,
    your tut its easy to follow and i think i did every thing right but,…
    i get a connection timeout any idea what i might have done wrong? or didnt do?

    1. Miguel,

      If you are getting a connection timeout I’d double check your port numbers and iptables. Make sure that which ever number you are using for your vncserver matches 590x port number. For example, if you choose 1 port = 5901, 2 then 5902. Also, don’t use 0 because that’s the remote-desktop vino-server listening on 5900.

      1. I agree with Miguel. The root cause of these timeout problems is port status being open/close or fire wall. You must have a strong background on iptables maintenance. Meaning you’ll be making updates in the iptables. What goes into the iptables and follows after an iptables updates.

  2. Hi there.

    I have installed a fresh copy of fedora 16 64bit.

    I follow all the above steps but when i type ‘sudo systemctl start vncserver@:3.service’ i get this error.

    ‘Job failed. See system logs and ‘systemctl status’ for details.’

    And in /var/log/messages i see the following.

    ‘May 7 15:50:34 Simba runuser[1625]: You will require a password to access your desktops.
    May 7 15:50:34 Simba runuser[1625]: getpassword error: Inappropriate ioctl for device
    May 7 15:50:34 Simba systemd[1]: vncserver@:3.service: control process exited, code=exited status=1
    May 7 15:50:34 Simba systemd[1]: Unit vncserver@:3.service entered failed state.’

    Also tried running yum update before installing vncserver but stil no luck.

    1. I am able to get around “getpassword error: Inappropriate ioctl for device” problem by installing tigervnc (yum install vnc)

  3. I Can’t “sudo systemctl enable vncserver@:3.service”
    Because, Fedora19 say ” Failed to issue method call: File exists.”

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s