Command Line Synergy (the software)

I thought I would connect two laptops today with Synergy (Wikipedia), a software I've been using on and off for years to allow two (or more) computers (each with at least one screen attached) to share the keyboard and mouse of just one of those computers. This is a fantastic program, but since 2014-09 it's been nagware unless you pay for it. It's technically open source software, but the devs are charging to download binaries and the compiled binaries produced on Linux (most distros have packages ... there are nightly builds available for Mac and Windows if you look hard enough - they used to be a way around the pay roadblock) all nag you to buy a license. Not precisely in the spirit of open source.

I thought I'd try using the graphical user interface, a binary simply called synergy: it worked well between a Mac and a Windows machine when I set it up a couple weeks ago. But the Linux graphical client doesn't seem to have seen much love, and in the end I found the command line easier.

Set up a ~/.synergy.conf file (name it anything you want, but I think this is the default) on both machines:

# Comments start with a leading hash.
# "master" is the hostname of the machine whose keyboard and mouse you'll be using.
# "slave" is the hostname of the secondary machine to be controlled.

section: screens

# if your machines both know each other's valid hostnames, an "aliases"
# section isn't necessary.  Obviously replace with your own IP addresses.

section: aliases

section: links
        right = slave
        left = master

section: options
    # you can leave this section out entirely unless you have actual
    # settings that go in here - I don't think I've ever used it.

On the master, run synergys -f --config ~/.synergy.conf. The --config is only needed if you have a non-default filename: I use several filenames to keep multiple configurations around for attaching different laptops to my main computer. The -f tells synergys to stay in the foreground - once you trust your configurations, you can remove this and let it run in the background.

At this point my methodology diverges somewhat from the orthodoxy: I think the official line would be to run synergyc -f master. I can't do this because of the firewall on 'master'. I could of course punch a hole through the firewall at port 24800 for synergy, but I'm going to use a somewhat trickier method. Synergy claims to support encryption: I've had trouble getting it to work in the past, and I've seen no documentation on it so I don't trust it. Don't run this without some form of encryption: if you're working on 'slave', anything you type on 'master's' keyboard (including passwords) would be transmitted in the clear over the local network. I prefer SSH - which takes care of the firewall and the encryption in one go. So we use SSH port forwarding to open the connection. On the slave, run ssh -f -N -L 24800:master:24800 master - once this command is authenticated to 'master,' run synergyc -f localhost. I had to stop and start both the server and client a couple of times as I read errors and corrected typos and misunderstandings. Once set up, things run much more smoothly.

You can set this up to support multiple computers and screens: I've only been up to a 1 x 3 array, but synergy is meant to be able to support many more than that.

Failure Attaching to a VM

This may seem like a bizarre use-case, and perhaps it is ... but I attempted to use synergy to connect 'master' to a VirtualBox VM on a second machine ... not to the second machine itself. This did not go well: the mouse pointer slid off the 'master' screen and onto the screen of the VM on the slave, but the pointer promptly locked in place and wouldn't move. Behaviour suggested that the pointer was in fact moving, I just couldn't see it doing so. And it could be moved back onto 'master'. I gave that up without attempting to debug it.