Much ado about scripting, Linux & Eclipse: card subject to change

2007-05-12

Synergy - multiple computers, one shared keyboard

At the suggestion of my summer co-op student & fellow linux evangelist, Neil Skrypuch, I've installed Synergy and can now control my three systems (desktop + two laptops) from a single keyboard. The most amusing part of this is that I can wrest control of my other half's mouse when she's playing cards to mess up her game.

In all seriousness, this is a very cool app which effectively eliminates my need for a KVM box, and also provides more function than a KVM, since not only can I now control multiple desktops from one place, I can also pass data between them. The best use of this so far is that I can select a URL on one machine and open it with another, as Synergy creates a shared clipboard all desktops can use. Very cool.

Here's how I have it set up:

  1. Server: Thinkpad w/ external monitor, keyboard, mouse. Located on left side of desk, with monitor in center of desk.
  2. Client #1: Desktop w/ backup keyboard/mouse (out of the way and rarely used). Located on right side of desk
  3. Client #2: SWMNBN's Thinkpad (for entertainment purposes only). Located on her desk, right of mine.

All I had to do was create an /etc/synergy.conf:

section: screens
  nickblappy:
  nickbdesk:
  TPAD:
end
section: links
  nickblappy:
    right = nickbdesk
  nickbdesk:
    left  = nickblappy
    right = TPAD
  TPAD:
    left = nickbdesk
end
section: options
  switchCorners = all
  switchCornerSize = 15
  switchDelay = 500
  screenSaverSync = false
  keystroke(alt+left) = switchInDirection(left)
  keystroke(shift+control+alt) = switchToScreen(nickblappy)
end

So, on startup of the Thinkpad (server), I run this alias:

alias SS='killall synergys; sleep 1; synergys'

And on the desktop:

alias SC='killall synergyc; sleep 1; synergyc 192.168.0.123'

As the second Thinkpad is running Windows, I just configure the client to auto-start on login and connect to the server's IP. To suppress warning messages when the server's powered down or travelling, I've set the Logging Level to Error instead of the default Warning.

That's it - it's crazy simple. You can also set linux clients/servers to run on startup, or to use SSH to encrypt data sent between machines.


Update:

To encrypt traffic with SSH, you need to do three things:

  1. Run OpenSSH on the server
  2. Run OpenSSH on the client, with local port forwarding. Here's a snippet of my ~/.ssh/config file:
    Host nickblappy
    Port 22
    Hostname 192.168.0.123
    
    Host localhost
    Port 22
    Hostname localhost
    LocalForward 24800 nickblappy:24800
  3. Change your alias to connect to localhost instead of the remote server:
    alias SC='killall synergyc; sleep 1; synergyc localhost'

    - or -

    alias SC='killall synergyc; sleep 2; screen ssh localhost "synergyc -f localhost"'

    (then CTRL-A,D to detach)

2 comments:

Unknown said...

just a note of caution about the use of Synergy. Indeed it is a very good application, we use it bundled with one of our products but be aware, when controlling other computers ALL of your keyboard strokes are being sent across the network, all your passwords, all your credit card details, everything, all unencrypted. This is one of the main reasonss why it had not been adopted in commercial applications.

nickb said...

Agreed - but that's why I only use my internal IPs for connecting and will be enabling ssh port forwarding to encrypt all transmissions.