Synergy is a really cool little program that allows one to share a keyboard, mouse, and clipboard seamlessly between multiple computers. I have it set up at work so that I can use my desktop keyboard and mouse to control my laptop.

I’ve been happy with it, but this morning it occurred to me that anyone on my work network could theoretically view all my keystrokes. So today I implemented a script to securely connect to the synergy server from my laptop. It is based on a suggestion from the synergy FAQ.

#!/bin/bash
# Opens a secure synergyc connection
#
# usage: synergyc_secure server [synergyc options]
#
# Author: Spencer Bliven

SERVER="${1:-desktop}"
shift
LPORT=24800
RPORT=24800

ssh -x -f -L $LPORT:localhost:$RPORT -o ExitOnForwardFailure=yes 
    "$SERVER" 'sleep 10' &&
synergyc "$@" localhost:$LPORT

Share

Leave a Reply

Your email address will not be published. Required fields are marked *