PDA

View Full Version : Fedora 20 start x11vnc at boot



Patrick Headley
12th June 2014, 11:20 PM
If you want to start x11vnc at boot-up in Fedora 20, follow these steps. I used information at

https://bbs.archlinux.org/viewtopic.php?id=168756

as a basis for this guide.

IMPORTANT: If you cannot afford to loose your data, create a backup.
If things don't go well, you may not be able to boot at all or you may end up in the recovery shell.

You can always practice these steps using a Fedora 20 Virtual Machine before doing anything on production machines.

1. Use Software from the GUI or Yum to install x11vnc. If the firewall is active (by default it is), open the vnc port (5900). Then, manually start x11vnc and verify that it works. You can test x11vnc by going to Activities in the GUI and type in x11VNC Server. The GUI will open and allow you to start the service.

There are other posts available to help you with installing x11vnc and opening a firewall port. For me this was very straight forward and it just worked.

2. In Terminal, CD to /etc/systemd/system.

3. Perform the editing of files as root (sudo).

4. Use gedit to create /etc/systemd/system/x11vnc.service. Copy the following text into the new file.


[Unit]
Description=VNC Server for X11
Requires=display-manager.service
After=display-manager.service

[Service]
Type=forking
ExecStart=/usr/bin/x11vnc -norc -forever -shared -bg -rfbauth /etc/x11vnc.pass -allow 192.168.11. -autoport 5900 -o /var/log/x11vnc.log

In ExecStart line I removed the -rfbauth parameter and path to the pass file but it should ideally be used.

In the ExecStart line I also set -allow to the first three segments of my network's IPv4 address, meaning clients on the same network are allowed to connect.

5. Save the file.

6. Use gedit to create /etc/systemd/system/graphical.target. Copy the following text into the new file.


# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.

[Unit]
Description=Graphical Interface
Documentation=man:systemd.special(7)
Requires=multi-user.target
After=multi-user.target
Conflicts=rescue.target
Wants=display-manager.service
Wants=x11vnc.service
AllowIsolate=yes

[Install]
Alias=default.target

7. Save the file.

8. Perform


sudo systemctl disable graphical.target

This command will delete default.target file. That is OK.

9. Perform


sudo systemctl enable graphical.target

The command will rebuilt default.target.

9. Perform the following command to restart the daemons This will perform the actions that occur at boot-up (items 9 and 10 may be in reverse order but that's how I received them):


sudo systemctl daemon-reload

10. Perform the following command to enable x11vnc to start at boot:


sudo systemctl enable x11vnc

11. Manually start x11vnc to make sure the daemon has started it, too. When the GUI opens it will default to port 5901 if the daemon has also started an instance at port 5900.

12. If all is working to this point, reboot and see if x11vnc starts at boot by performing the previous step again.

There are currently no troubleshooting tips.