This is a read-only archive. Find the latest Linux articles, documentation, and answers at the new!


Synergy: One keyboard (and mouse) to rule them all

By Joe 'Zonker' Brockmeier on June 15, 2006 (8:00:00 AM)

Share    Print    Comments   

If you're one of the many users who has two (or more) computers on your desk, you might get tired of switching between the keyboard and mouse on different systems. KVMs are one solution, but if you'd like to save a few bucks and be able to switch between two or more computers with a flick of the mouse, Synergy is the software for you.

Synergy allows you to use a single keyboard and mouse to control multiple computers running Linux, Mac OS X, Windows, and other operating systems. It also allows you to share clipboards between computers, so you can select text in a program on Linux, and paste it into an application in Windows. Best of all, Synergy is freely available under the GNU General Public License (GPL).

Setting up Synergy

To start, grab Synergy packages or source code for your platforms of choice. Binaries are available for Linux (as RPMs), Mac OS X, and Windows. Install Synergy on all of the systems where you want to share a keyboard and mouse.

If you're using Debian or Ubuntu, you can install Synergy using apt-get install synergy. One word of caution, though -- Debian Sarge and Ubuntu Breezy have packages based on the 1.2 series, and Debian Etch and Ubuntu Dapper have packages based on the 1.3 series. The protocols for 1.2 and 1.3 are incompatible. If you want to use Synergy with Dapper and Breezy, you'll need to compile Synergy 1.3.1 from source.

After you've installed Synergy in a manner befitting your favorite operating systems, it's time to configure Synergy. You'll need to create a file called ~/.synergy.conf, or /etc/synergy.conf if you want a system-wide configuration.

Here's a sample synergy.conf file:

# This section defines the hosts.
section: screens
          super = meta

# This section defines the relationships between the hosts.
section: links
	    right = host2
	    left  = host1

section: options
      switchDelay = 1000

Synergy alternatives

Synergy isn't the only way to control several desktops using a single keyboard and mouse, and it has its advantages and disadvantages. For example, if you want to control a computer that's not running a GUI, then Synergy isn't an option and you should probably look at buying a KVM switch. Also, Synergy doesn't provide a way to actually share a monitor, though the developers say they're looking into this, so if you're looking to save on costs by sharing hardware, a KVM again might be a good option.

The downside to using a KVM switch, however, is that most KVMs require you to use either USB or PS/2 equipment. You can't mix and match, which is something of a pain if you are using a PC with a PS/2 keyboard and mouse alongside a PC or Mac with USB keyboard and mouse. Also, you need to use a hotkey sequence to switch between computers, rather than just moving the mouse to the edge of the screen and rolling over to the next screen. Also, KVMs for sharing two or four systems can be reasonably priced, but switches for sharing more than four systems get pretty expensive. Finally, if I'm actively working between two computers, I don't want to share a monitor between them -- I'd like to be able to eyeball the screen for my test system while I'm typing on the other, so sharing a monitor via a KVM isn't such a wonderful feature for me.

Another option is x2vnc, which is slightly easier to set up than Synergy, but suffers from poor performance, and does not share a clipboard between systems. Also, x2vnc is limited to two computers, so if you want to control three or four computers, you're out of luck.

The advantage to x2vnc is that it should work with any system that can run a VNC server, so you could use x2vnc with a Linux system any system that can run a VNC server. Synergy is limited to Unix-type OSes, Windows, and recent versions of Mac OS X.

If you're using two X-based systems, x2x is also an option. Again, x2x is limited to two systems.

The first section includes all of the hosts that will be connected using Synergy. The option under host2 indicates that when the Super key (usually the "Win" key) is pressed on the keyboard, it will be sent to the client as the meta key. See the list of key names for the entire list of remappable keys.

The next section maps the relationships between the hosts. In this example, when I move the mouse to the right edge of the screen on host1, it will roll over to host2, and back to host1 after I move the mouse to the edge of the screen on host2. You can also map screens "up" or "down." You do need to explicitly define the relationships for both hosts -- i.e., saying host2 is to right of host1 doesn't mean that Synergy will assume host1 is to the left of host2.

The options section is, well, optional. I like the switchDelay option, which tells the Synergy server to wait a short period of time before sending the mouse and keyboard input to the other system when the mouse is on the edge of the screen. The time is measured in milliseconds, so you'll probably want to set it to at least 1000.

You can read about the configuration options on the Synergy Web site, or read the synergys man page. Note that you don't need a configuration on the client computers -- just the server.

Running Synergy

After you've set up the configuration file on the host that will be the Synergy server, start Synergy and see how it works. First, fire up the server with synergys -f. This will start the server in the foreground (-f), which will allow you to eyeball Synergy's event messages. You'll want to do that the first time (at least) so you can see any error messages that you might have.

Next, start the Synergy client on your other machines, using synergyc -f hostname , with hostname being the hostname of the Synergy server.

If you didn't get any errors, you should now be able to move the mouse to the corner of the screen and have it roll over to the next system, and use the other system normally with the Synergy server's keyboard and mouse.

After you've gotten Synergy working well, you can drop the -f option from synergys and synergyc, and it will run quietly in daemon mode. If you'd like to start Synergy automatically, see the docs on the Synergy site.

Share    Print    Comments   


on Synergy: One keyboard (and mouse) to rule them all

Note: Comments are owned by the poster. We are not responsible for their content.


Posted by: Anonymous Coward on June 16, 2006 12:56 AM
Yeah, well, ssh costs nothing and allows you to work on multiple machines simultaneously. A kvm only allows a connection to a single machine at a time. Ever tried to copy and paste between different machines on a kvm?



Posted by: Anonymous Coward on June 16, 2006 04:01 AM
Since you didn't actually read the blurb (or the article)...

The whole point of *Synergy* is that it shares your peripheral(s) between two GUIs and it has a clipboard. Oh yeah, synergy is GPL too.



Sharing mouse keyboard and screen?

Posted by: Anonymous Coward on June 19, 2006 11:45 PM
This is good, but is there any app that can share the screen as well? So when you roll off the edge of the screen the picture changes to the other computer's?

TIA if anyone knows


Alternatives for the text-only user

Posted by: Anonymous Coward on June 15, 2006 11:29 PM
If you're looking to do something like this on a text-only machine, then screen might be the easiest option.

Screen effectively provides a set of virtual consoles. There are several ways you might want to set this up:

  - VNC-style: Run screen on your host machine. Do whatever you want to do. Then, from another machine, ssh into your host machine and run "screen -x" - this will allow you to see and control that screen remotely.

  - Synergy-style: Run screen on your client machine. Simply set up one of your screens as an SSH into your host machine. You can even have multiple sessions on both your client machine and your host machine

There are other uses too... for example, if you disconnect from screen, it keeps all your sessions and processes running in the background - ideal for overnight batch jobs, as you can reattach in the morning and check the status. Just make sure the system won't be rebooted, because that will delete the screen session!!

Most commands are available through pressing Ctrl-a, then a letter - try ctrl-a then ? (question mark)

Hope that's useful!!



Posted by: Anonymous Coward on June 15, 2006 11:59 PM
I've been using x2vnc and win2vnc for a while now, I've noticed that while x2vnc runs slowly on linux (not too bad, but noticable) on windows and mac it's imperceptible. and It is possible to have more than two computers attached, you just need multiple instances of win2vnc running, one for each computer, I have also had an instance running on a client computer so moving off the right of each monitor takes you to the next computer.



Posted by: Anonymous Coward on December 06, 2006 01:55 AM
I'm having trouble concatenating multiple windowz PCs with x2VNC/win2VNC.

I have 2 windowz PCs next to my Linux (main) box.
I've got VNC (TightVNC Server version 1.2.9) running on the 2 windows boxes.

I run X2vnc on linux (v1.6.1) and connect to the Window PC next to me (WINPC1) fine.

However, if WINPC1 has win2vnc connected to the next windows PC (WINPC2), my cursor leaves my linux box and just skips WINPC1 and goes directly to WINPC2.

Can you post your exact configuration where this is working?


Sharing the mouse/keyboard

Posted by: Anonymous Coward on June 16, 2006 03:31 AM
So, does someone want to explain how to hook up that mouse and keyboard to multiple computers at once? You'd think the article might at least mention how to do that.

I imagine the answer is a USB hub. They are cheaper than KVM switches, but that's still more hardware to buy. And a USB hub would only work with USB devices, of course.


Re:Sharing the mouse/keyboard

Posted by: Anonymous Coward on June 16, 2006 03:39 AM
What are you talking about? Synergy IS a way to "hook up that mouse and keyboard to multiple computers at once"


Re:Sharing the mouse/keyboard

Posted by: Anonymous Coward on June 16, 2006 05:33 AM
The sytems are networked. That is why whatever happens to be plugged in to one computer can appear on a different monitor and control that different computer.

I can understand your confusion. Not once was network connectivity mentioned, but that is how it works.

So, the mouse keyboard can be USB, serial, PS/2 or whatever works.

No additional hubs or cables to buy and the software is free as in freedom AND beer.


Re:Sharing the mouse/keyboard

Posted by: Anonymous Coward on June 17, 2006 12:49 AM
Thanks - It would have helped if the article had mentioned "networked" computers to begin with - yours is the only comment that has been of any help to me.


Re:Sharing the mouse/keyboard

Posted by: Anonymous Coward on June 16, 2006 05:41 AM
A Synergy "server" runs on one PC, a Synergy "client" runs on the other PC, and they communicate via TCP/IP.

Each PC uses its own attached monitor, and the Synergy server shares its keyboard and mouse with the client. When you run your mouse off the edge of the server's screen, the mouse appears on the client's screen and both mouse and keyboard become associated with the client.

Its pretty darn slick.

And you can leave the client PC's keyboard+mouse attached if you want - just put them out of the way.

Tinfoil hat types will install a secondary NIC in each PC for Synergy purposes, so that keystrokes aren't traversing the normal LAN wire.



Posted by: Anonymous Coward on June 16, 2006 04:21 AM
Oh, wow. I just spent an hour installing and setting this up, using a RHEL server and a Mac OS X client. I did have to compile the server from source on the Red Hat box, since what with a 64-bit system I had RPM-dependency hell. However, that went easily, and it basically worked immediately as soon as I opened the firewall. Note that the system is NOT encrypted, and does not require password access to work. What I did, following the instructions on the web site, was to close down the firewall hole, then use SSH tunneling on the client to connect. This requires just a password on the client side, then everything works beautifully. Oh, and if you've got a nice Dell monitor with dual inputs, you can hook both systems up to the same monitor and use that as the M part of a KVM switch. What a fantastic bit of software!



Posted by: Anonymous Coward on June 16, 2006 06:45 AM
I indeed use it with a Dell dual-input monitor. It was always so awkward to use the second keyboard and mouse that are off to the side, and then twist the head all the time to see the display. With this, all I do is switch the monitor input. Cool stuff.


Works Great under SUSE..

Posted by: Anonymous Coward on June 16, 2006 11:52 PM
I am running SUSE 10.0 on dual screens here at work and installed it from YAST. It took about 5 minutes to configure it so I could control my XP laptop. I got rid of my external keyboard and mouse and my desk looks much bigger. Next step is to get another flat panel and a docking station. Very Cool!


x2x with more than two computers

Posted by: Anonymous Coward on June 17, 2006 05:00 AM
You can hook up as many computers as you like with x2x in any geometry, it's just designed to be used with multiple instances. It can also run through an ssh tunnel for security.


Hooked on Synergy

Posted by: Anonymous Coward on June 19, 2006 10:49 PM
I've been running synergy for several years now. Primarily with a Mandrake/Mandriva server and a Win2K/Win XP client. Cut and paste between systems can be [b]VERY convenient[/b]. Sometimes I also have my dual-boot laptop in the mix, so I'm using one mouse and keyboard to run three machines.

I keep the Windows machine's mouse in reach, and a keyboard for it lives on top of the (CRT) monitor. Sometimes I want ALT-Print Screen or CTRL-ALT-DEL to get the process manager on the WinXP box, and you can't do that from the synergy server keyboard. One [b]occasional[/b] glitch is that the WinXP client box starts seeing left (server) mouse clicks as right clicks, and right clicks as nothing. If I click once on the left button of the client's mouse, then everything is back to normal - that's why I keep the client's mouse hooked up and in reach.

I highly recommend using Synergy.



RIght on.

Posted by: Anonymous Coward on June 20, 2006 01:13 AM
This is EXACTLY my situation at work where I have a Windows laptop for email and document editing, and a Linux workstation for doing real work, and Synergy is the perfect solution. I actually had written my own clipboard sharing app previously, but Synergy takes it to the next level.


I think you don't see the point

Posted by: Administrator on June 16, 2006 12:36 AM
The thing here is not to save some bucks by using the same keyboard... is more like this:

You have two computers, right? and you have two monitors... on each you have different things running, even with different operating systems... with synergy you move the mouse and you point to the first computer and start typing a replay to an email, send the mail you go back to the main computer to keep working on what ever you are doing...

I have a kvm and I managed to buy another monitor because it is really more comfortable. You can see both computers at the same time, and you point to switch, can't be easiest as that.

It is awesome. And you have clipboard sharing between them!

I am using Synergy with Windows AND Linux and it runs smoothly. I just love it!

<a href="" title="">Donde Ser Geek No Duele</a>


Synergy: One keyboard (and mouse) to rule them all

Posted by: Anonymous [ip:] on January 16, 2008 12:18 PM
You can simulate sending Ctrl-Alt-Del to the other, remote, system by moving your mouse to that system and then pressing Ctrl-Alt-Pause (or the pause/break key, which ever you have).


This story has been archived. Comments can no longer be posted.

Tableless layout Validate XHTML 1.0 Strict Validate CSS Powered by Xaraya