Get Quicksynergy secured with ssh really easy!

Since I wanted to have quicksynergy set up with an ssh tunnel for a long time, I finally thougth about a way to make things easier:

1) hack a wrapper-script together, which does the magic ssh tunneling

2) still use the nice GUI from quicksynergy

3) don't need to start the client seperately - the wrapper script will take care of this!

Since things are a bit confusing:

LOCHOST is the one, where your keyboard & mouse is connected to. We will use Quicksynergy with this and it will run synergys on this side.

REMHOST is the PC which will be remotely controlled via synergy. Our wrapper script will take care of starting synergyc on this side.

This is a draft for the wrapper script, which should be put in: /usr/local/bin/synergys

I still need to include the parsing of the config file. The filename of the config file is passed in the commandline, so we can get the hostname of the remote host from the screenname defined in the config. If you like to do the parsing .. you're welcome to leave a comment on how you did it!

#! /bin/bash -x


LOCHOST="clementine.local"
REMHOST="freebook" #needs to be just the hostname (without .local)"
PORT=24800
REMCMD="/usr/bin/synergyc -f --no-restart --name $REMHOST localhost"

# PARSE $* TO GET REMOTE AND LOCAL HOSTNAME
# replace hostnames # take it for granted, that screenname.local ist remote hostname.

killall /usr/bin/synergys
/usr/bin/ssh ${REMHOST} 'killall /usr/bin/synergyc'

/usr/bin/synergys -d FATAL $* &

#/usr/bin/ssh -R 24800:clementine.local:24800 freebook.local '/usr/bin/synergyc -f --no-restart --name freebook localhost '
/usr/bin/ssh -R ${PORT}:${LOCHOST}:${PORT} ${REMHOST} ${REMCMD}

# doesn' get to this point yet. how do we handle the stopping of quicksynergy?
killall /usr/bin/synergys