8 Nov 2010

How I use Synergy

Have you heard of Synergy?  This is a cool application that allows you to share one physical keyboard and mouse across multiple computers you use.  I have been using Synergy for years, and I'm going to share my Synergy setup in this post.

Basic setup is done by writing a configuration file on the server machine as shown in Synergy manual.  In addition to letting you share keyboard and mouse, Synergy does another sweet thing: it synchronizes clipboards on all the connected machines.  What this means is that you can copy some text on one computer and paste it on another!  I love this feature.  But one thing I was not comfortable with: all Synergy communication over the network is done in plaintext.  Every day I would be sending a lot of information over the wire without even being aware of it!  URLs, email addresses, code snippets, and so on.  I don't like it.

Any TCP/IP connection can be encrypted (without the app having to support encryption) using SSH tunnels.  Synergy site has some information about using tunnels to secure Synergy traffic.  Using that setup requires typing a password to establish the tunnel every time I start synergyc, the Synergy client program.  I don't like that either.

First thing I did was to set up public key/private key authentication to the server computer -- one on which I run synergys, and run ssh-agent on the client computer -- one on which I run synergyc.  (Mark A. Hershberger has written a detailed guide for doing this.)  This would let me log into the server from the client without having to  type a password.  Then, I wrote a Python script that would set up an SSH tunnel and start Synergy client.  Now, instead of running synergyc command I run my synergyc.py script, and everything works as expected.

The script sets up a tunnel and starts the client.  My first version, which I wrote a few years ago, was very naive.  For example, it would freak out when the client loses connection to the server, and I will have to manually restart the client.  Now the script is much improved and works pretty well for my usage.  The script is available on GitHub.  Feel free to use it, review the code, send patches, send feedback/bug report, etc.  (Remember to change SERVER_HOST_NAME in the script to your server's host name before using the script though :)

No comments:

Post a Comment