I am using the program synergy together with an ssh tunnel
It works, i just have to open an console an type these two commands:
ssh -f -N -L localhos
You can drop the -f, which makes it run it in background, then run it with eval and force it to the background yourself.
-f
eval
You can then grab the pid. Make sure to put the & within the eval statement.
pid
&
eval "ssh -N -L localhost:12345:otherHost:12345 otherUser@OtherHost & " tunnelpid=$!