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!


16 Replies to “How To: Configure Synergy Client systemd Service Auto-Start in Linux (Fedora 20)”

  1. Hey,
    first of all thanks for the guide, I had some minor issues I’d like to share in case you want to fix them or someone else gets stuck and looks for helpful comments:
    1. “systemctl –user …” has to be “systemctl –user” (especially in the synergy.desktop file this error can get very annoying and hard to find)
    2. “cp synergy.service ~/.config/systemd/user/” should be “cp /lib/systemd/system/synergyc.service ~/.config/systemd/user/” as being in a certain directory is not part of this guide.
    3. In the first line of synergyc.desktop a linefeed is missing.

    I made myself another issue: I thought it would be fun to try “systemctl –user enable synergyc.service” – well it wasn’t any fun, don’t do it: Synergy or systemctl (not sure which one) will refuse to start due to being started to frequently. And it took me some time to find out that adding an additional starting event actually broke everything.

    Thanks again for your work, I really appreciate it!

    1. Glad you found it useful, sorry for the errors though. I am adding edits for those now, thanks pointing them out!

  2. I have done all the steps in this tutorial, unforunately whenever I do ‘sudo systemctl start synergyc.service’ I am unable to use Synergy from my server machine. It would appear that, though the service is started, it isn’t DOING anything. Ideas?

    1. From your Linux client, if you use the Syngery GUI (just type ‘synergy’ in a command prompt), are you able to properly connect to your Synergy server and share the mouse/keyboard between the two?

      If not, you need to get that configuration working first before creating the Synergy client service. If the above does work, then:
      1) Make sure that while the GUI is working, that you grab the appropriate command from the output of “ps -eo command | grep -v grep | grep synergyc”
      2) Make sure you added the “-f” option to the ExecStart= line in the /lib/systemd/system/synergyc.service file (right after /usr/bin/synergyc)
      3) After attempting to start the synergyc.service, what is the output of ‘sudo systemctl -l status synergyc.service’?

    2. When you are logged in as a user (I believe this is almost always the case when you type commands.) you have to use
      ‘systemctl –user start synergyc.service’.
      I believe the command you posted has the purpose to run Synergy when you are not logged in i.e. when the login-screen is shown.
      I hope that helps!

      PS: Replace the character before user with two times ‘-‘ if it is not shown that way.

  3. You should install the system synergyc.service under /etc/systemd/system, not /usr/lib/systemd/system, for several reasons: 1. ‘man systemd.unit’ recommends it, 2. if you use etckeeper to manage your configuration changes, storing your custom services in /etc lets you keep it under version control

    1. Thanks for the suggestion Eric, I did not realize /etc/systemd/system was the recommended location. I read over the systemd.unit man page, but I did not see any specific suggestion to place the .service file in /etc/systemd/system instead of /usr/lib/systemd/system, at least, not explicitly. I see both listed at the top, I guess since the /etc/ path is listed two spaces higher than the /usr/ path that is supposed to be the part where it is recommended?

  4. This (complicated) recipe does not seem to work on Fedora 22. All the time, synergyc only runs after I log in. It does not allow me to login without connecting a keyboard/mouse, which kind of defeats the whole purpose of synergy.

    1. Hi John,

      I don’t have my desktop system available for testing, but did you create the file “/lib/systemd/system/synergyc.service”?

      If so, verify its contents are correct and try the following to help determine the cause:
      – Check the logs: sudo journalctl -l –unit=synergyc.service
      – Try to start it manually (this should be done after stopping the synergyc process that was started after you logged in): sudo systemctl start synergyc.service
      – Check status of the service: sudo systemctl -l status synergyc.service

      Hopefully those should help get you more information to troubleshoot the problem.

      1. Yes, I have all the files and did all the tests. The services work and transition fine when triggered by systemctl.

        However, the first service doesn’t start on boot. The log says :

        Jul 25 14:28:37 localhost.localdomain synergyc[1238]: WARNING: secondary screen unavailable: unable to open screen
        Jul 25 14:28:37 localhost.localdomain systemd[1]: synergyc.service: main process exited, code=dumped, status=11/SEGV
        Jul 25 14:28:37 localhost.localdomain systemd[1]: Unit synergyc.service entered failed state.

        Until it gives up after the fifth try.

        I’m guessing that this is why I can’t login.

  5. I believe to have followed all the directions to the letter and still on restart I have to use an attached keyboard to login, but after that synergy is started and I can use the shared mouse and keyboard.

    The last comment from Eric confused me as he talks about /usr/lib/systemd, but the instructions say /lib/systemd. Even the response from Stephen lists /usr/lib/systemd, so is that my issue? should have used /usr/lib/systemd/… ?


    1. Hey Farzad,

      Technically either /usr/lib/systemd/ or /lib/systemd/ should work. I do not have my Fedora system available for testing, and probably won’t until August. In the mean time, check my response to John K’s comment, as it could help you with troubleshooting your issue.

      If you find any error logs or want to share the contents of your synergyc.service file (after removing the crypto pass), then feel free to reply here and I will see if there is anything I see that might help.

  6. took a lot of notes and studying for the rhel7 exam I really liked the way you used the new features of rhel7. plan on following up later and sharing what I do on github. thanks a lot!!! 😀

  7. D’ye think your recipe will work on Mint Cinnamon 18.1?

    Mint uses mdm rather than gdm, so I must edit the file /etc/mdm/PreSession/Default rather than the nonexistent gdm

    And Mint has other oddities that might complicate matters (tho’ I think its a lovely distro once one corrects the mess they made of Samba).

    Many thanks for your walkthrough – I’ll try it as soon as I’ve made a system image 😉

    1. Unfortunately, I can’t say from experience if it will or not, but my instincts feel that it should. Best of luck with it, and I hope it works for you! Let us know here if it does.

Leave a Reply

Your email address will not be published. Required fields are marked *