How To: Configure Synergy Client systemd Service Auto-Start in Linux (Fedora 20)

Edit (2014-07-02): I would like to thank David for commenting and pointing out some small typos and errors in commands and files.

I was looking for a solution to the following problem:

  1. I wanted the Synergy client process (synergyc) to start on boot so I could use the mouse and keyboard from another computer to enter the log in credentials at the graphical log in screen on my Fedora desktop.
  2. I wanted synergyc to be run as a background service that would automatically restart itself if it crashed for whatever reason.
  3. I wanted synergyc to not be running as the root user whenever possible.


The solution for the above requires that you create a systemd system service for synergyc, edit the file /etc/gdm/PreSession/Default to kill all synergyc processes, create a systemd user instance service for synergyc, and create the file ~/.config/autostart/synergyc.desktop to start the systemd user instance service for synergyc.  Skip to the directions section for specific instructions


  1. TLDR
    1. Install and Configure Synergy
    2. Create systemd Service for synergyc
    3. Make System Kill Initial synergyc Process Upon Login
    4. Verify systemd User Instance Starts on Boot
    5. Create User Instance synergyc.service File
    6. Create synergyc.desktop Autostart File
  4. Wrapping Up
  5. References


I love Synergy!  For those of you who do not know what it is, Synergy is a software based KVM switch; it allows you to use the keyboard and mouse that are plugged in to one computer to control other computers on your network.  So for instance I have three computers running at the same time right now (from left to right) – personal-laptop, personal-desktop, work-laptop.

My Computer Desk Setup
My Computer Desk Setup

My main keyboard and mouse is plugged into my work laptop.  Using Synergy, I can swipe my mouse from my work laptop screen to my desktop screen, and then use the mouse and keyboard on my desktop (as if they were plugged into the USB ports on my desktop).  I can also send the mouse all the way over to my personal laptop and control that with the mouse and keyboard plugged into my work laptop (whatever screen the mouse is currently on, is the one that the mouse and keyboard input will be sent to).

On my desktop, which has a newly installed Fedora 20 system, I wanted a way to start the Synergy client (synergyc) automatically so once the computer starts I can use the mouse and keyboard attached to my work laptop to control my Fedora system.  I found a simple way by created the file “~/.config/autostart/synergyc.desktop” and adding the appropriate values in there.  This worked, however if the synergyc client crashed for whatever reason, it would not automatically restart itself (it wasn’t a service after all, just an auto-start script).  I also found that I could create a systemd service to start on boot, but I had a couple of issues with this method as well:

  1. That service would be running as root, which could potentially be a security concern.
  2. Once I logged in to my Fedora system, if the synergyc service crashed for whatever reason, then it would not be able to restart itself .  Long story short (and perhaps not 100% technically correct), at that point the root user did not have access to the X display since control of it was given to my logged in user.  So if I started synergyc process at this point as my regular user, it would work just fine.

As I looked further into systemd, I learned about systemd user instances.  These are instances of systemd run as a user (with a specific user’s permissions) and it allows said user to start/stop/restart/check status of their own services that they want running (usually only started when that user logs on).  This looked promising as it would allow me to run synergyc as a service using my user’s permissions, taking away the security issue presented by running the service as root.  Unfortunately systemd user instances also proved to be troublesome.

After a lot of testing, troubleshooting, and finally getting my head wrapped around the concept of systemd user instances, I found that the user instance is started too late to allow my user’s synergyc service to be used for log in (issue 1 I wanted resolve), and started too early after logging in to allow my synergyc service to start successfully (my user did not have control of X display).  I could have added a restart delay timer in my systemd user service version of the synergyc service, but I found a different way that I thought was more promising — use a combination of systemd system services (normal systemd services), systemd user instance services, and desktop auto-start files (~/.config/autostart/*.desktop).


The following directions were verified to work on my Fedora 20 64-bit system.  Hopefully your experience will be the same, though your mileage may vary.  I cannot guarantee exactly what will happen with your system, and I take no responsibility for any issues this causes.  Follow these at your own risk.

If you do not understand what a certain command or component might be doing, then I suggest you research it to fully understand what changes you are making to your system.

Install and Configure Synergy

If you don’t have it already, you’re going to need to download and install Synergy.

  1. Download — Go to and grab the appropriate file for your version of Linux.  In my case with Fedora 20 64-bit,  Or via command line:
    $ wget
  2. Install — Go to where you downloaded the file, and install it.
    $ cd ~/Downloads/
    $ sudo yum -y localinstall synergy-1.4.15-Linux-x86_64.rpm
  3. Get a working configuration — Open Synergy (in command line type: synergy) and edit your settings to successfully connect to your Synergy server running on another computer.  Verify you can connect to your server successfully.
  4. Copy the command used by synergyc to run and connect to your server — Run the following command and look for the line that starts with /usr/bin/synergyc:
    $ ps -eo command | grep -v grep | grep synergyc

    Note: The line should look something like
    /usr/bin/synergyc -d INFO -n YourHostName YourServerName:24800
    Note: If you use synergy’s built-in encryption then the option –crypto-pass <yourPasswordHash> will also be present. Example:
    /usr/bin/synergyc -d INFO -n pcName –crypto-pass passwordHashHere ServerName:24800

  5. Now stop synergy and close it.

Create systemd Service for synergyc

Creating this service will cause the synergyc service to start when the system boots, and will allow you to use the mouse and keyboard from your synergy server to enter the username and password to log into your system.

  1. Using your favorite text editor, create the file /lib/systemd/system/synergyc.service.
  2. Copy and paste the following config into the file.  In the ExecStart= line, put the entire command you found above, and make sure to add the “-f” option after /usr/bin/synergyc (as shown in the config below).  If you would like to have synergyc log to a specific file (instead of only using the default journald log), add this option after the -d option, -l /path/to/log-file/writeable/by/your/user.
    Description=Synergy client service
    ExecStart=/usr/bin/synergyc -f -d INFO -n pcName --crypto-pass passwordHashHere ServerName:24800
  3. Save your file.
  4. Give the file the appropriate permissions and ownership
    $ sudo chown root:root /lib/systemd/system/synergyc.service
    $ sudo chmod 0644 /lib/systemd/system/synergyc.service
  5. Have systemd add this service to its known list
     $ sudo systemctl daemon-reload
  6. Make sure it starts correctly:
     $ sudo systemctl start synergyc.service
  7. Make sure you can restart it:
     $ sudo systemctl restart synergyc.service
  8. Make sure you can stop it:
     $ sudo systemctl stop synergyc.service
  9. Make it load on boot
     $ sudo systemctl enable synergyc.service

Make System Kill Initial synergyc Process Upon Login

We need to kill this initial synergyc process since we don’t want to create a duplicate synergyc process, it was started as root, and it will not auto-restart itself if it crashes.

  1. Use your favorite text editor to edit the file /etc/gdm/PreSession/Default
    At bottom of file, add:

    # Need this line to kill the synergyc process started at boot
    killall synergyc

  2. Save the file

Verify systemd User Instance Starts on Boot

We just need to check that your systemd user instance is starting on boot.  This should be the default action of your system.

  1. Find your userid — At the command line type the following command, and look for “uid=####(username)”, where #### is any number, most likely 1000 (doesn’t have to be 1000, whatever is there is your userid).
    $ id
  2. Make sure a sytemd user instance has been created for your user
    $ sudo systemctl status user@####.service

    Verify systemd User Instance Running
    Verifying Your User Instance is Running

Create User Instance synergyc.service File

Now we need to create the synergyc.service file to use for our systemd user instance.

  1. Create appropriate directory
     $ mkdir -p ~/.config/systemd/user
  2. Copy systemd system synergyc.service file to our new directory
     $ cp /lib/systemd/system/synergyc.service ~/.config/systemd/user/
  3. In the new file, ~/.config/systemd/user/synergyc.service , change the line, , to be,
  4. Make your user instance aware of the service, and verify you can start, restart, and stop it:
    $ systemctl --user daemon-reload
    $ systemctl --user start synergyc.service
    $ systemctl --user restart synergyc.service
    $ systemctl --user stop synergyc.service

Create synergyc.desktop Autostart File

Now we need to create our synergyc.desktop file, which will run once we log in to our system.

  1. Create the file ~/.config/autostart/synergyc.desktop
  2. Copy and paste the config below into the file, then save your file.
    [Desktop Entry]
    GenericName=Software KVM
    Comment=Share your keyboard and mouse over a network
    Exec=systemctl --user start synergyc.service

Wrapping Up

You should now be able to reboot your system and control it from your Synergy server as soon as the graphical log in screen is displayed.  Please see the references below which helped me to create this guide.  If you have any questions or comments, leave them below!