≡ Menu

How to Configure Synergy on Linux to Share Keyboard and Mouse with Multiple Systems

Synergy is an open source network utility which can be used to share one keyboard and mouse with multiple systems.

Synergy utility works on client-server model.

The system whose keyboard and mouse you want to share, runs the synergy server service (synergys), and all the other systems runs the synergy client service (synergyc) to connect to server.

Synergy is a platform independent utility. Compiled version of synergy is available for various platforms including Windows, Linux, Mac OS X, Android and Apple iOS. You can download source code and compiled version from here.

Use the appropriate package management command to install Synergy on your system as shown below. For Windows, you can directly download executable and install it.

# For Mac OSX :
sudo port install synergy

# For Fedora, CentOs and RHEL :
sudo yum install synergy

# For Ubuntu, LinuxMint and Debian :
sudo apt-get install synergy

Example Synergy Configuration Setup

In my case, I have three systems mac-dev (OSX Maverick 10.9.1), nix-dev (Ubuntu), fed-dev (Fedora 20) which is connected in local network.

Synergy Keyboard Mouse

After installation, you need to define a configuration file to run synergy.

Configuration file has information about how these systems are connected in X,Y Plane. The synergy configuration file has the following sections:

  1. screens
  2. links
  3. aliases
  4. options

The default syntax of all sections is shown below. Just replace the name to one of the above section name.

section: name
arguments
end

Screens Section

Screens section will specify how many systems are going to connect through synergy service.

In screens section, either you can use either ip address or hostname of the systems.

Following is my configuration file for screens section. Here I’ve used two hostname and one ip-address (for fed-dev system).

section: screens
10.112.10.27:
nix-dev:
mac-dev:
end

Links Section

Links section will specify how these systems are going to connect in X,Y Plane.

There are four options such as left, right, down and up to connect screens to each other. Before writing link section, keep the system on which you want to run synergy server service ( it means you want to use keyboard and mouse of the system in all systems which are connected across local network.

In my setup, I want to use nix-dev systems keyboard and mouse in mac-dev, and fed-dev. So, I kept nix-dev in center and mac-dev of left of nix-dev and fed-dev is right of the nix-dev. In links section, you can write any screen first or last, it doesn’t matter.

section: links
nix-dev:
left = mac-dev
right = 10.112.10.27
mac-dev:
right = nix-dev
10.112.10.27:
left=nix-dev
end

Aliases Section

In aliases section, you could write alias for domain name to use short name in screens and links sections.

section: aliases
nix-dev:
nix-dev.thegeekstuff.com
mac-dev:
mac-dev.thegeekstuff.com
end

Options Section

In options section, there are list of arguments which can be use to modify uses of synergy service in configuration. You can get full list of options from synergy website.

section: options
keystroke(alt+left) = switchInDirection(left)
end

Start Synergy Service

For minimum configuration, you need atleast two options such as screens and links.

In the system which has keyboard and mouse, you need to start synergy server service as shown below, which will wait for all client to connect according to configuration file.

synergys -f -c mysynergy.conf

-f flags : To run synergy server service in foreground, by default it runs in the background
-c flags : to pass configuration file to synergy server service

For other connected systems, start synergy client service with server hostname or server ip address on which synergy server service is running as shown below.

synergyc -f nix-dev

or

synergyc -f 10.112.10.26

-f flags : to run synergy server service in foreground

Debugging Synergy Issues

The following “failed to connect to server” is a common synergy service error message.

WARNING: failed to connect to server:
NOTE: connecting to ’nix-dev’: 10.112.10.26:24800

In most case, the above error message is because of the firewall not allowing the client to talk to the server. Modify the iptables rules accordingly to allow port 24800.

If you have’ve installed different version of synergy client and server, you might get the following message. In this case, make sure to install the same version on both server and all the clients.

WARNING: failed to connect to server: incompatible client 1.4
NOTE: connecting to ’nix-dev’: 10.112.10.26:24800
Add your comment

If you enjoyed this article, you might also like..

  1. 50 Linux Sysadmin Tutorials
  2. 50 Most Frequently Used Linux Commands (With Examples)
  3. Top 25 Best Linux Performance Monitoring and Debugging Tools
  4. Mommy, I found it! – 15 Practical Linux Find Command Examples
  5. Linux 101 Hacks 2nd Edition eBook Linux 101 Hacks Book

Bash 101 Hacks Book Sed and Awk 101 Hacks Book Nagios Core 3 Book Vim 101 Hacks Book

Comments on this entry are closed.

  • prakash March 20, 2014, 2:08 am

    Nice one…… always pleasure to read tgs articles…..

  • Jalal Hajigholamali March 20, 2014, 6:20 am

    Hi,

    Thanks a lot, very useful article
    I enjoyed it…

  • chris March 21, 2014, 1:18 pm

    There is also a UI version of the program. You can get it from their site. It makes things a lot easier for the casual user.

  • devender shekhawat March 26, 2014, 1:57 pm

    Thanks a lot…
    waiting for new post.

  • Pratik April 1, 2014, 5:04 am

    Amazing

  • damich April 5, 2014, 3:55 pm

    I have been using Synergy for a few months now and it is great. I currently have a Windows machine acting as the server and a Mint machine as a client. The only problem I have is that I can’t get synergy to start automatically during boot on the Mint machine. Any advice on that?

  • Sanjay kumar August 7, 2014, 4:11 am

    @damich: Currently i have wrote script for my setup which i will manually run in each system after booting. I have done alias command in my .bashrc file which i will run as start in each system such as :
    alias startc=”synergyc -f nimrodel”
    alias starts= synergys -f -c synergy.conf”

    but i will write init function today and paste it here soon.

    Thanks for comments.

  • Arun Chaudhary September 5, 2014, 8:58 am

    not able to connect centos 6 as server and ubuntu 12.04 as client ..
    plz help me

  • sanjay September 8, 2014, 4:33 pm

    @Arun: start synergys on server with -f flag and on the client side with -f and tell me output then i can help you out in that issue

  • Arun Chaudhary September 8, 2014, 10:54 pm

    @Sanjay: Thanks for the reply sanjay….Everything is fine now.

  • anondren November 5, 2014, 7:03 am

    How to enable 24800. port number in fedora

  • Anonymous June 18, 2015, 8:35 pm

    This is an interesting solution. I will be trying this to share a Keyboard and mouse with Windows 8.1 and Ubuntu Server

  • Stephane marchand November 26, 2015, 5:10 pm

    How bizarre !
    Installed synergy 1.3 on debian wheezy
    and synergy 1.3.8 on windows 10.

    Weird thing :
    1. the mouse on the server can “traverse” to the client and back.
    but not the mouse on the client.
    2. the client keyboard not working on the server but again
    the server keyboard work on the client.
    running on the server :
    synersys -f –config /etc/synergy.conf
    and running gui synergy 1.3.8 on windows with no
    specific options.

    conf:
    section: screens
    192.168.1.107:
    192.168.1.124:
    end

    section: aliases
    voyager:
    192.168.1.124
    bigass:
    192.168.1.107
    end

    section: links
    bigass:
    down = voyager
    voyager:
    up = bigass
    end

    section: options
    screenSaverSync = false
    end

    thanks for any sugestion
    steph

  • Sanjay Kumar June 17, 2016, 5:18 pm

    @Stephane marchand : Did you read the article?
    This article shows that you can use server keyboard and mouse on all the clients. Maximum you can connect 9 client with one server. So Server System Keyboard and mouse will work on all clients but not vice versa.

    Regards
    sanjayk