11.25.2005

[Tech] 1 keyboards, 2 hosts

A co-worker of mine turned me on to a product called 'Synergy' which is a software KVM type switch. It is very nice. I allows me to use one keyboard on mouse on multiple machines.

Here is my setup:

laptop (left client): Mac OSx 10.4.2

workstation (host): Solaris 10

My workstation (solaris 10 host) is the Synergy server (we will call it host1 to protect the innocent). My laptop is a synergy client (we will call it client1 to protect the innocent). I downloaded the source code for synergy and compiled it. On my laptop (client1) I let it install (./configure, make, sudo make install) into the default /usr/local/bin, on my workstation (host1) I compiled it and installed it into /opt/synergy/bin. Synergy on non-windows requires that you create a config file. Here is my synergy.conf file:

---start synergy.conf---
section: screens
host1:
client1:
meta = alt
end
section: links
host1:
left = client1
client1:
right = host1
end
section: aliases
client1:
client1.mydomain.edu
host1:
host1.mydomain.edu
end

I then started the server on host1:

/opt/synergy/bin/synergys -f -c /opt/synergy/bin/synergy.conf

(note synergy's default behavior is to background in daemon mode, the -f keeps it in the foreground, which is useful for testing). I didn't receive any errors, so I moved on to my laptop where I started the client:

/usr/local/bin/synergyc -f host1

I saw a successful connection message on the server and poof! I was linked! But this is not very secure, as things are passed unencrypted. But wait! Here is where my trusty friend SSH came in. I tunnelled the traffic over SSH between my two systems and it worked.

I used this link as a guide, but found that the example synergy.conf did not completely work for my mix of Solaris, OSX and synergy, so I did things a little differently (see my .conf above).

My procedure was this:

1. start synergy server on host1 at port 7777
/opt/synergy/bin/synergys -a host1.mydomain.edu:7777 -c /opt/synergy/bin/synergy.conf

2. establish a ssh tunnel from client1 to host1 with my user account
ssh -f -N -L1024:host1.mydomain.edu:7777 myname@host1

3. start synergy client on client1 and point to localhost:1024

4. enjoy

Helpful tips:
* make sure you enable port forwarding on the SSHD config
* use the same versions of synergy on all systems
* setup authorized ssh keys on each system to allow you to connect back and forth with minimal fuss, but this method works without them as well
* add the 'meta = alt' part under the OSX entry if you are using a SUN type keyboard and want to use the 'meta' (diamond shaped key) as the apple 'command' key.

2 comments:

AllThingsSpring said...

I tend to do the same thing, but as a full VNC session. Set up multiple boxes on a LAN, with only power and ethernet cables on the boxes except my workstation and then just run VNC sessions (or tunnel encrypted sessions over SSH much as you did with Synergy if I'm connecting to remote boxes). Having dual flat screen monitors helps a lot, and you can run your own workstation on one screen and a remote box via VNC on the other.

I should also add, to those who work in a Windows environment, that if you ever have a computer set up without a keyboard and plugging one in doesn't work for some reason, there is a mouse driven on-screen keyboard built into the OS:

%SystemRoot%\system32\osk.exe

A shortcut is in the Start->All Programs->Accessories->Accessibility
folder.

The opposite problem can be gotten around sans mouse using keyboard shortcuts (Ctrl-Esc is the same as the 'Window' key on a lot of keyboards, Tab allows you to move through fields, Alt-Tab switches applications that are open, Ctrl-Shift-Esc is Task Manager, and of course CTRL-ALT-DEL brings up the security window)

Nerdwife said...

Nerds! (pointing, snickering)